From 8fca1bfc7577a0ce88f3c61c6a9b92c8adbb848a Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 1 Sep 2022 10:26:28 +0530 Subject: Use a simpler SecretKeyRingProtector (#2099) --- .../kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'crypto-pgpainless') diff --git a/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt b/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt index 74f880a2..faa94dff 100644 --- a/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt +++ b/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt @@ -24,7 +24,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions import org.pgpainless.encryption_signing.EncryptionOptions import org.pgpainless.encryption_signing.ProducerOptions import org.pgpainless.exception.WrongPassphraseException -import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector +import org.pgpainless.key.protection.SecretKeyRingProtector import org.pgpainless.util.Passphrase public class PGPainlessCryptoHandler @Inject constructor() : CryptoHandler { @@ -41,11 +41,7 @@ public class PGPainlessCryptoHandler @Inject constructor() : CryptoHandler PGPainless.readKeyRing().secretKeyRing(key.contents) } .run(::PGPSecretKeyRingCollection) - val protector = - PasswordBasedSecretKeyRingProtector.forKey( - keyringCollection.first(), - Passphrase.fromPassword(passphrase) - ) + val protector = SecretKeyRingProtector.unlockAnyKeyWith(Passphrase.fromPassword(passphrase)) PGPainless.decryptAndOrVerify() .onInputStream(ciphertextStream) .withOptions( -- cgit v1.2.3