Package org.bouncycastle.openpgp.api
Class OpenPGPKey.OpenPGPPrivateKey
java.lang.Object
org.bouncycastle.openpgp.api.OpenPGPKey.OpenPGPPrivateKey
- Enclosing class:
OpenPGPKey
Unlocked
OpenPGPKey.OpenPGPSecretKey
.-
Constructor Summary
ConstructorsConstructorDescriptionOpenPGPPrivateKey
(OpenPGPKey.OpenPGPSecretKey secretKey, PGPKeyPair unlockedKey) -
Method Summary
Modifier and TypeMethodDescriptionchangePassphrase
(char[] newPassphrase) Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked with the new passphrase.changePassphrase
(char[] newPassphrase, OpenPGPImplementation implementation, boolean useAEAD) Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked with the new passphrase.changePassphrase
(char[] newPassphrase, PBESecretKeyEncryptorFactory keyEncryptorFactory) Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked with the new passphrase.changePassphrase
(PBESecretKeyEncryptor keyEncryptor) Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked using the givenPBESecretKeyEncryptor
.Return the unlockedPGPKeyPair
containing the decryptedPGPPrivateKey
.Return the publicOpenPGPCertificate.OpenPGPComponentKey
of thisOpenPGPKey.OpenPGPPrivateKey
.Return theOpenPGPKey.OpenPGPSecretKey
in its potentially locked form.Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
with removed passphrase protection.
-
Constructor Details
-
OpenPGPPrivateKey
-
-
Method Details
-
getPublicKey
Return the publicOpenPGPCertificate.OpenPGPComponentKey
of thisOpenPGPKey.OpenPGPPrivateKey
.- Returns:
- public component key
-
getSecretKey
Return theOpenPGPKey.OpenPGPSecretKey
in its potentially locked form.- Returns:
- secret key
-
getKeyPair
Return the unlockedPGPKeyPair
containing the decryptedPGPPrivateKey
.- Returns:
- unlocked private key
-
changePassphrase
Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked with the new passphrase. If the key was unprotected before, or if it was protected using AEAD, the new instance will be protected using AEAD as well.- Parameters:
newPassphrase
- new passphrase- Returns:
- new instance of the key, locked with the new passphrase
- Throws:
PGPException
- if the key cannot be locked
-
changePassphrase
public OpenPGPKey.OpenPGPSecretKey changePassphrase(char[] newPassphrase, OpenPGPImplementation implementation, boolean useAEAD) throws PGPException Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked with the new passphrase.- Parameters:
newPassphrase
- new passphraseimplementation
- OpenPGP implementationuseAEAD
- whether to protect the key using AEAD- Returns:
- new instance of the key, locked with the new passphrase
- Throws:
PGPException
- if the key cannot be locked
-
changePassphrase
public OpenPGPKey.OpenPGPSecretKey changePassphrase(char[] newPassphrase, PBESecretKeyEncryptorFactory keyEncryptorFactory) throws PGPException Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked with the new passphrase.- Parameters:
newPassphrase
- new passphrasekeyEncryptorFactory
- factory forPBESecretKeyEncryptor
instances- Returns:
- new instance of the key, locked with the new passphrase
- Throws:
PGPException
- if the key cannot be locked
-
changePassphrase
public OpenPGPKey.OpenPGPSecretKey changePassphrase(PBESecretKeyEncryptor keyEncryptor) throws PGPException Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
locked using the givenPBESecretKeyEncryptor
.- Parameters:
keyEncryptor
- encryptor- Returns:
- new instance of the key, locked with the key encryptor
- Throws:
PGPException
- if the key cannot be locked
-
removePassphrase
Return a NEW instance of theOpenPGPKey.OpenPGPSecretKey
with removed passphrase protection.- Returns:
- unlocked new instance of the key
- Throws:
PGPException
- if the key cannot be unlocked
-