From db01ed2a2e2a210de33cc96751b7a5281a96db77 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 16 Jul 2022 21:25:04 +0530 Subject: Use `KeyRingUtils#publicKeyRingCollectionFrom` to extract public keys (#2009) --- .../app/passwordstore/crypto/PGPainlessCryptoHandlerTest.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crypto-pgpainless/src/test/kotlin/app') diff --git a/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandlerTest.kt b/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandlerTest.kt index 60e8fb6e..4dc0abd5 100644 --- a/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandlerTest.kt +++ b/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandlerTest.kt @@ -19,9 +19,10 @@ import kotlin.test.assertTrue import org.junit.runner.RunWith @Suppress("Unused") // Test runner handles it internally -enum class EncryptionKey(val key: PGPKey) { - PUBLIC(PGPKey(TestUtils.getArmoredPublicKey())), - SECRET(PGPKey(TestUtils.getArmoredPrivateKey())), +enum class EncryptionKey(val keySet: List) { + PUBLIC(listOf(PGPKey(TestUtils.getArmoredPublicKey()))), + SECRET(listOf(PGPKey(TestUtils.getArmoredPrivateKey()))), + ALL(listOf(PGPKey(TestUtils.getArmoredPublicKey()), PGPKey(TestUtils.getArmoredPrivateKey()))), } @RunWith(TestParameterInjector::class) @@ -35,7 +36,7 @@ class PGPainlessCryptoHandlerTest { fun encryptAndDecrypt() { val ciphertextStream = ByteArrayOutputStream() cryptoHandler.encrypt( - listOf(encryptionKey.key), + encryptionKey.keySet, CryptoConstants.PLAIN_TEXT.byteInputStream(Charsets.UTF_8), ciphertextStream, ) @@ -53,7 +54,7 @@ class PGPainlessCryptoHandlerTest { fun decryptWithWrongPassphrase() { val ciphertextStream = ByteArrayOutputStream() cryptoHandler.encrypt( - listOf(encryptionKey.key), + encryptionKey.keySet, CryptoConstants.PLAIN_TEXT.byteInputStream(Charsets.UTF_8), ciphertextStream, ) -- cgit v1.2.3