aboutsummaryrefslogtreecommitdiff
path: root/crypto-pgpainless
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-09-01 10:26:28 +0530
committerGitHub <noreply@github.com>2022-09-01 04:56:28 +0000
commit8fca1bfc7577a0ce88f3c61c6a9b92c8adbb848a (patch)
tree527feb1b240e05c87c248fac7b7fc60750e9c53a /crypto-pgpainless
parentb21e6039d89d0f5ee7bc91a33802e8ac833529e9 (diff)
Use a simpler SecretKeyRingProtector (#2099)
Diffstat (limited to 'crypto-pgpainless')
-rw-r--r--crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPainlessCryptoHandler.kt8
1 files changed, 2 insertions, 6 deletions
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<PGPKey> {
@@ -41,11 +41,7 @@ public class PGPainlessCryptoHandler @Inject constructor() : CryptoHandler<PGPKe
keys
.map { key -> 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(