Package org.pgpainless.key.protection
Class BaseSecretKeyRingProtector
- java.lang.Object
-
- org.pgpainless.key.protection.BaseSecretKeyRingProtector
-
- All Implemented Interfaces:
SecretKeyRingProtector
- Direct Known Subclasses:
PasswordBasedSecretKeyRingProtector
public class BaseSecretKeyRingProtector extends Object implements SecretKeyRingProtector
-
-
Constructor Summary
Constructors Constructor Description BaseSecretKeyRingProtector(SecretKeyPassphraseProvider passphraseProvider)
BaseSecretKeyRingProtector(SecretKeyPassphraseProvider passphraseProvider, KeyRingProtectionSettings protectionSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor
getDecryptor(Long keyId)
Return a decryptor for the key of idkeyId
.org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor
getEncryptor(Long keyId)
Return an encryptor for the key of idkeyId
.boolean
hasPassphraseFor(Long keyId)
-
-
-
Constructor Detail
-
BaseSecretKeyRingProtector
public BaseSecretKeyRingProtector(SecretKeyPassphraseProvider passphraseProvider)
-
BaseSecretKeyRingProtector
public BaseSecretKeyRingProtector(SecretKeyPassphraseProvider passphraseProvider, KeyRingProtectionSettings protectionSettings)
-
-
Method Detail
-
hasPassphraseFor
public boolean hasPassphraseFor(Long keyId)
- Specified by:
hasPassphraseFor
in interfaceSecretKeyRingProtector
-
getDecryptor
@Nullable public org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor getDecryptor(Long keyId) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingProtector
Return a decryptor for the key of idkeyId
. This method returns null if the key is unprotected.- Specified by:
getDecryptor
in interfaceSecretKeyRingProtector
- Parameters:
keyId
- id of the key- Returns:
- decryptor for the key
- Throws:
org.bouncycastle.openpgp.PGPException
-
getEncryptor
@Nullable public org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor getEncryptor(Long keyId) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingProtector
Return an encryptor for the key of idkeyId
. This method returns null if the key is unprotected.- Specified by:
getEncryptor
in interfaceSecretKeyRingProtector
- Parameters:
keyId
- id of the key- Returns:
- encryptor for the key
- Throws:
org.bouncycastle.openpgp.PGPException
- if the encryptor cannot be created for some reason
-
-