public class PasswordBasedSecretKeyRingProtector extends Object implements SecretKeyRingProtector
PBESecretKeyDecryptor
and PBESecretKeyEncryptor
objects while getting the passphrases
from a SecretKeyPassphraseProvider
and using settings from an KeyRingProtectionSettings
.Modifier and Type | Field and Description |
---|---|
protected SecretKeyPassphraseProvider |
passphraseProvider |
protected KeyRingProtectionSettings |
protectionSettings |
Constructor and Description |
---|
PasswordBasedSecretKeyRingProtector(KeyRingProtectionSettings settings,
SecretKeyPassphraseProvider passphraseProvider)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor |
getDecryptor(Long keyId)
Return a decryptor for the key of id
keyId . |
org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor |
getEncryptor(Long keyId)
Return an encryptor for the key of id
keyId . |
protected final KeyRingProtectionSettings protectionSettings
protected final SecretKeyPassphraseProvider passphraseProvider
public PasswordBasedSecretKeyRingProtector(@Nonnull KeyRingProtectionSettings settings, @Nonnull SecretKeyPassphraseProvider passphraseProvider)
passphraseProvider
and decryptors/encryptors are constructed
following the settings given in settings
.settings
- S2K settings etc.passphraseProvider
- provider which provides passphrases.@Nullable public org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor getDecryptor(Long keyId)
SecretKeyRingProtector
keyId
.
This method returns null if the key is unprotected.getDecryptor
in interface SecretKeyRingProtector
keyId
- id of the key@Nullable public org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor getEncryptor(Long keyId) throws org.bouncycastle.openpgp.PGPException
SecretKeyRingProtector
keyId
.
This method returns null if the key is unprotected.getEncryptor
in interface SecretKeyRingProtector
keyId
- id of the keyorg.bouncycastle.openpgp.PGPException
- if the encryptor cannot be created for some reason