Class OpenPGPKey
java.lang.Object
org.bouncycastle.openpgp.api.OpenPGPCertificate
org.bouncycastle.openpgp.api.OpenPGPKey
An
OpenPGPKey (TSK - transferable secret key) is the pendant to an OpenPGPCertificate,
but containing the secret key material in addition to the public components.
It consists of one or multiple OpenPGPKey.OpenPGPSecretKey objects.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUnlockedOpenPGPKey.OpenPGPSecretKey.static classSecret key component of aOpenPGPCertificate.OpenPGPPrimaryKeyorOpenPGPCertificate.OpenPGPSubkey.Nested classes/interfaces inherited from class OpenPGPCertificate
OpenPGPCertificate.OpenPGPCertificateComponent, OpenPGPCertificate.OpenPGPComponentKey, OpenPGPCertificate.OpenPGPComponentSignature, OpenPGPCertificate.OpenPGPIdentityComponent, OpenPGPCertificate.OpenPGPPrimaryKey, OpenPGPCertificate.OpenPGPSignatureChain, OpenPGPCertificate.OpenPGPSignatureChains, OpenPGPCertificate.OpenPGPSubkey, OpenPGPCertificate.OpenPGPUserAttribute, OpenPGPCertificate.OpenPGPUserId -
Field Summary
Fields inherited from class OpenPGPCertificate
keyRing -
Constructor Summary
ConstructorsConstructorDescriptionOpenPGPKey(PGPSecretKeyRing keyRing) Create anOpenPGPKeyinstance based on aPGPSecretKeyRing.OpenPGPKey(PGPSecretKeyRing keyRing, OpenPGPImplementation implementation) Create anOpenPGPKeyinstance based on aPGPSecretKeyRing, a providedOpenPGPImplementationand itsOpenPGPPolicy.OpenPGPKey(PGPSecretKeyRing keyRing, OpenPGPImplementation implementation, OpenPGPPolicy policy) Create anOpenPGPKeyinstance based on aPGPSecretKeyRing, a providedOpenPGPImplementationandOpenPGPPolicy. -
Method Summary
Modifier and TypeMethodDescriptionReturn aListcontaining allcomponentsof the certificate.byte[]getEncoded(PacketFormat packetFormat) Return a byte array containing the binary representation of the certificate, encoded using the given packet length encoding format.Return thePGPKeyRingthat this certificate is based on.Return the underlyingPGPSecretKeyRing.Return theOpenPGPKey.OpenPGPSecretKeyof this key's primary key.getSecretKey(KeyIdentifier identifier) Return theOpenPGPKey.OpenPGPSecretKeyidentified by the passedKeyIdentifier.Return theOpenPGPKey.OpenPGPSecretKeythat corresponds to the passedOpenPGPCertificate.OpenPGPComponentKey.Return aMapcontaining allOpenPGPKey.OpenPGPSecretKeycomponents (secret subkeys) of the key.booleanReturn true, if this object is anOpenPGPKey, false otherwise.Return theOpenPGPCertificateof thisOpenPGPKey.Methods inherited from class OpenPGPCertificate
getAllKeyIdentifiers, getAllUserIds, getCertification, getCertification, getCertificationKeys, getCertificationKeys, getComponentKeysWithFlag, getDelegationBy, getDelegationBy, getEncoded, getEncryptionKeys, getEncryptionKeys, getExpirationTime, getExpirationTime, getFingerprint, getIdentities, getKey, getKeyIdentifier, getKeys, getLastModificationDate, getLastModificationDateAt, getPGPPublicKeyRing, getPrettyFingerprint, getPrimaryKey, getPrimaryUserId, getPrimaryUserId, getPublicKeys, getRevocation, getRevocation, getRevocationBy, getRevocationBy, getSigningKeyFor, getSigningKeys, getSigningKeys, getSubkeys, getUserId, getValidKeys, getValidKeys, getValidUserIds, getValidUserIds, join, join, toAsciiArmoredString, toAsciiArmoredString, toAsciiArmoredString
-
Constructor Details
-
OpenPGPKey
Create anOpenPGPKeyinstance based on aPGPSecretKeyRing. TheOpenPGPImplementationwill be acquired by invokingOpenPGPImplementation.getInstance().- Parameters:
keyRing- secret key ring
-
OpenPGPKey
Create anOpenPGPKeyinstance based on aPGPSecretKeyRing, a providedOpenPGPImplementationand itsOpenPGPPolicy.- Parameters:
keyRing- secret key ringimplementation- OpenPGP implementation
-
OpenPGPKey
public OpenPGPKey(PGPSecretKeyRing keyRing, OpenPGPImplementation implementation, OpenPGPPolicy policy) Create anOpenPGPKeyinstance based on aPGPSecretKeyRing, a providedOpenPGPImplementationandOpenPGPPolicy.- Parameters:
keyRing- secret key ringimplementation- OpenPGP implementationpolicy- OpenPGP policy
-
-
Method Details
-
isSecretKey
public boolean isSecretKey()Description copied from class:OpenPGPCertificateReturn true, if this object is anOpenPGPKey, false otherwise.- Overrides:
isSecretKeyin classOpenPGPCertificate- Returns:
- true if this is a secret key
-
toCertificate
Return theOpenPGPCertificateof thisOpenPGPKey.- Returns:
- certificate
-
getComponents
Description copied from class:OpenPGPCertificateReturn aListcontaining allcomponentsof the certificate. Components are primary key, subkeys and identities (user-ids, user attributes).- Overrides:
getComponentsin classOpenPGPCertificate- Returns:
- list of components
-
getPrimarySecretKey
Return theOpenPGPKey.OpenPGPSecretKeyof this key's primary key.- Returns:
- primary secret key
-
getSecretKeys
Return aMapcontaining allOpenPGPKey.OpenPGPSecretKeycomponents (secret subkeys) of the key.- Returns:
- secret key components
-
getSecretKey
Return theOpenPGPKey.OpenPGPSecretKeyidentified by the passedKeyIdentifier.- Parameters:
identifier- key identifier- Returns:
- corresponding secret key or null
-
getSecretKey
Return theOpenPGPKey.OpenPGPSecretKeythat corresponds to the passedOpenPGPCertificate.OpenPGPComponentKey.- Parameters:
key- component key- Returns:
- corresponding secret key or null
-
getPGPKeyRing
Description copied from class:OpenPGPCertificateReturn thePGPKeyRingthat this certificate is based on.- Overrides:
getPGPKeyRingin classOpenPGPCertificate- Returns:
- underlying key ring
-
getPGPSecretKeyRing
Return the underlyingPGPSecretKeyRing.- Returns:
- secret key ring
-
getEncoded
Description copied from class:OpenPGPCertificateReturn a byte array containing the binary representation of the certificate, encoded using the given packet length encoding format.- Overrides:
getEncodedin classOpenPGPCertificate- Parameters:
packetFormat- packet length encoding format- Returns:
- binary encoded certificate
- Throws:
IOException- if the certificate cannot be encoded
-