mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 06:45:19 +00:00
Use a simpler SecretKeyRingProtector (#2099)
This commit is contained in:
@@ -24,7 +24,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions
|
|||||||
import org.pgpainless.encryption_signing.EncryptionOptions
|
import org.pgpainless.encryption_signing.EncryptionOptions
|
||||||
import org.pgpainless.encryption_signing.ProducerOptions
|
import org.pgpainless.encryption_signing.ProducerOptions
|
||||||
import org.pgpainless.exception.WrongPassphraseException
|
import org.pgpainless.exception.WrongPassphraseException
|
||||||
import org.pgpainless.key.protection.PasswordBasedSecretKeyRingProtector
|
import org.pgpainless.key.protection.SecretKeyRingProtector
|
||||||
import org.pgpainless.util.Passphrase
|
import org.pgpainless.util.Passphrase
|
||||||
|
|
||||||
public class PGPainlessCryptoHandler @Inject constructor() : CryptoHandler<PGPKey> {
|
public class PGPainlessCryptoHandler @Inject constructor() : CryptoHandler<PGPKey> {
|
||||||
@@ -41,11 +41,7 @@ public class PGPainlessCryptoHandler @Inject constructor() : CryptoHandler<PGPKe
|
|||||||
keys
|
keys
|
||||||
.map { key -> PGPainless.readKeyRing().secretKeyRing(key.contents) }
|
.map { key -> PGPainless.readKeyRing().secretKeyRing(key.contents) }
|
||||||
.run(::PGPSecretKeyRingCollection)
|
.run(::PGPSecretKeyRingCollection)
|
||||||
val protector =
|
val protector = SecretKeyRingProtector.unlockAnyKeyWith(Passphrase.fromPassword(passphrase))
|
||||||
PasswordBasedSecretKeyRingProtector.forKey(
|
|
||||||
keyringCollection.first(),
|
|
||||||
Passphrase.fromPassword(passphrase)
|
|
||||||
)
|
|
||||||
PGPainless.decryptAndOrVerify()
|
PGPainless.decryptAndOrVerify()
|
||||||
.onInputStream(ciphertextStream)
|
.onInputStream(ciphertextStream)
|
||||||
.withOptions(
|
.withOptions(
|
||||||
|
Reference in New Issue
Block a user