public static class OpenPGPKey.OpenPGPSecretKey extends OpenPGPCertificate.OpenPGPComponentKey
OpenPGPCertificate.OpenPGPPrimaryKey
or
OpenPGPCertificate.OpenPGPSubkey
.rawPubkey
Constructor and Description |
---|
OpenPGPSecretKey(OpenPGPCertificate.OpenPGPComponentKey pubKey,
PGPSecretKey secKey,
PBESecretKeyDecryptorBuilderProvider decryptorBuilderProvider)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
OpenPGPCertificate.OpenPGPComponentSignature |
getLatestSelfSignature(java.util.Date evaluationTime)
Return the (at evaluation time) latest self-signature on the component.
|
OpenPGPKey |
getOpenPGPKey()
Return the
OpenPGPKey which this OpenPGPKey.OpenPGPSecretKey belongs to. |
PGPSecretKey |
getPGPSecretKey()
Return the underlying
PGPSecretKey . |
protected OpenPGPCertificate.OpenPGPCertificateComponent |
getPublicComponent()
Return the public
OpenPGPCertificate.OpenPGPCertificateComponent that belongs to this component. |
OpenPGPCertificate.OpenPGPComponentKey |
getPublicKey()
Return the public
OpenPGPComponentKey corresponding to this OpenPGPKey.OpenPGPSecretKey . |
boolean |
isLocked()
If true, the secret key is not available in plain and likely needs to be decrypted by providing
a key passphrase.
|
boolean |
isPassphraseCorrect(char[] passphrase)
Return true if the provided passphrase is correct.
|
boolean |
isPrimaryKey()
Return true, if this
OpenPGPCertificate.OpenPGPComponentKey represents the primary key of an OpenPGPCertificate . |
java.lang.String |
toDetailString()
Return a detailed String representation of this component.
|
OpenPGPKey.OpenPGPPrivateKey |
unlock()
Unlock an unprotected
OpenPGPKey.OpenPGPSecretKey . |
OpenPGPKey.OpenPGPPrivateKey |
unlock(char[] passphrase)
Access the
PGPKeyPair by unlocking the potentially locked secret key using the provided
passphrase. |
OpenPGPKey.OpenPGPPrivateKey |
unlock(KeyPassphraseProvider passphraseProvider)
Unlock a protected
OpenPGPKey.OpenPGPSecretKey . |
equals, getAlgorithm, getCreationTime, getKeyComponent, getKeyIdentifier, getPGPPublicKey, getVersion, hashCode, isCertificationKey, isCertificationKey, isEncryptionKey, isEncryptionKey, isSigningKey, isSigningKey
getAEADCipherSuitePreferences, getAEADCipherSuitePreferences, getApplyingSubpacket, getCertificate, getCertification, getCompressionAlgorithmPreferences, getCompressionAlgorithmPreferences, getFeatures, getFeatures, getHashAlgorithmPreferences, getHashAlgorithmPreferences, getKeyExpirationDate, getKeyExpirationDateAt, getKeyFlags, getKeyFlags, getLatestSelfSignature, getMergedDanglingExternalSignatureChainEndsFrom, getRevocation, getSignatureChains, getSymmetricCipherPreferences, getSymmetricCipherPreferences, hasKeyFlags, isBound, isBoundAt
public OpenPGPSecretKey(OpenPGPCertificate.OpenPGPComponentKey pubKey, PGPSecretKey secKey, PBESecretKeyDecryptorBuilderProvider decryptorBuilderProvider)
pubKey
- corresponding public key componentsecKey
- secret keydecryptorBuilderProvider
- for unlocking private keysprotected OpenPGPCertificate.OpenPGPCertificateComponent getPublicComponent()
OpenPGPCertificate.OpenPGPCertificateComponent
OpenPGPCertificate.OpenPGPCertificateComponent
that belongs to this component.
For public components (pubkeys, identities...), that's simply this, while secret components
return their corresponding public component.
This is used to properly map secret key and public key components in Maps
that use
components
as map keys.getPublicComponent
in class OpenPGPCertificate.OpenPGPCertificateComponent
public boolean isPrimaryKey()
OpenPGPCertificate.OpenPGPComponentKey
OpenPGPCertificate.OpenPGPComponentKey
represents the primary key of an OpenPGPCertificate
.isPrimaryKey
in class OpenPGPCertificate.OpenPGPComponentKey
public OpenPGPCertificate.OpenPGPComponentSignature getLatestSelfSignature(java.util.Date evaluationTime)
OpenPGPCertificate.OpenPGPCertificateComponent
getLatestSelfSignature
in class OpenPGPCertificate.OpenPGPComponentKey
evaluationTime
- reference timepublic OpenPGPKey getOpenPGPKey()
OpenPGPKey
which this OpenPGPKey.OpenPGPSecretKey
belongs to.public java.lang.String toDetailString()
OpenPGPCertificate.OpenPGPCertificateComponent
toDetailString
in class OpenPGPCertificate.OpenPGPCertificateComponent
public PGPSecretKey getPGPSecretKey()
PGPSecretKey
.public OpenPGPCertificate.OpenPGPComponentKey getPublicKey()
OpenPGPComponentKey
corresponding to this OpenPGPKey.OpenPGPSecretKey
.public boolean isLocked()
public OpenPGPKey.OpenPGPPrivateKey unlock() throws PGPException
OpenPGPKey.OpenPGPSecretKey
.PGPException
- if the key cannot be unlockedpublic OpenPGPKey.OpenPGPPrivateKey unlock(KeyPassphraseProvider passphraseProvider) throws PGPException
OpenPGPKey.OpenPGPSecretKey
.passphraseProvider
- provider for key passphrasesPGPException
- if the key cannot be unlockedpublic OpenPGPKey.OpenPGPPrivateKey unlock(char[] passphrase) throws PGPException
PGPKeyPair
by unlocking the potentially locked secret key using the provided
passphrase. Note: If the key is not locked, it is sufficient to pass null as passphrase.passphrase
- passphrase or nullPGPException
- if the key cannot be unlockedpublic boolean isPassphraseCorrect(char[] passphrase)
passphrase
- passphrase