1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-23 12:52:07 +01:00

CachingSecretKeyRingProtector: Add addPassphrase(OpenPgpV4Fingerprint, Passphrase)

This commit is contained in:
Paul Schaub 2021-06-26 17:37:10 +02:00
parent dae5288456
commit 41b8d15cec

View file

@ -26,6 +26,7 @@ import org.bouncycastle.openpgp.PGPKeyRing;
import org.bouncycastle.openpgp.PGPPublicKey; import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor; import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor; import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor;
import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider; import org.pgpainless.key.protection.passphrase_provider.SecretKeyPassphraseProvider;
import org.pgpainless.util.Passphrase; import org.pgpainless.util.Passphrase;
@ -82,6 +83,10 @@ public class CachingSecretKeyRingProtector implements SecretKeyRingProtector, Se
addPassphrase(key.getKeyID(), passphrase); addPassphrase(key.getKeyID(), passphrase);
} }
public void addPassphrase(@Nonnull OpenPgpV4Fingerprint fingerprint, @Nullable Passphrase passphrase) {
addPassphrase(fingerprint.getKeyId(), passphrase);
}
/** /**
* Remove a passphrase from the cache. * Remove a passphrase from the cache.
* The passphrase will be cleared and then removed. * The passphrase will be cleared and then removed.