public class OpenPGPKey extends OpenPGPCertificate
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.Modifier and Type | Class and Description |
---|---|
static class |
OpenPGPKey.OpenPGPPrivateKey
Unlocked
OpenPGPKey.OpenPGPSecretKey . |
static class |
OpenPGPKey.OpenPGPSecretKey
Secret key component of a
OpenPGPCertificate.OpenPGPPrimaryKey or
OpenPGPCertificate.OpenPGPSubkey . |
OpenPGPCertificate.OpenPGPCertificateComponent, OpenPGPCertificate.OpenPGPComponentKey, OpenPGPCertificate.OpenPGPComponentSignature, OpenPGPCertificate.OpenPGPIdentityComponent, OpenPGPCertificate.OpenPGPPrimaryKey, OpenPGPCertificate.OpenPGPSignatureChain, OpenPGPCertificate.OpenPGPSignatureChains, OpenPGPCertificate.OpenPGPSubkey, OpenPGPCertificate.OpenPGPUserAttribute, OpenPGPCertificate.OpenPGPUserId
keyRing
Constructor and Description |
---|
OpenPGPKey(PGPSecretKeyRing keyRing)
Create an
OpenPGPKey instance based on a PGPSecretKeyRing . |
OpenPGPKey(PGPSecretKeyRing keyRing,
OpenPGPImplementation implementation)
Create an
OpenPGPKey instance based on a PGPSecretKeyRing ,
a provided OpenPGPImplementation and its OpenPGPPolicy . |
OpenPGPKey(PGPSecretKeyRing keyRing,
OpenPGPImplementation implementation,
OpenPGPPolicy policy)
Create an
OpenPGPKey instance based on a PGPSecretKeyRing ,
a provided OpenPGPImplementation and OpenPGPPolicy . |
Modifier and Type | Method and Description |
---|---|
java.util.List<OpenPGPCertificate.OpenPGPCertificateComponent> |
getComponents()
Return a
List containing all components of 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.
|
PGPSecretKeyRing |
getPGPKeyRing()
Return the
PGPKeyRing that this certificate is based on. |
PGPSecretKeyRing |
getPGPSecretKeyRing()
Return the underlying
PGPSecretKeyRing . |
OpenPGPKey.OpenPGPSecretKey |
getPrimarySecretKey()
Return the
OpenPGPKey.OpenPGPSecretKey of this key's primary key. |
OpenPGPKey.OpenPGPSecretKey |
getSecretKey(KeyIdentifier identifier)
Return the
OpenPGPKey.OpenPGPSecretKey identified by the passed KeyIdentifier . |
OpenPGPKey.OpenPGPSecretKey |
getSecretKey(OpenPGPCertificate.OpenPGPComponentKey key)
Return the
OpenPGPKey.OpenPGPSecretKey that corresponds to the passed OpenPGPComponentKey . |
java.util.Map<KeyIdentifier,OpenPGPKey.OpenPGPSecretKey> |
getSecretKeys()
Return a
Map containing all OpenPGPKey.OpenPGPSecretKey components (secret subkeys) of the key. |
boolean |
isSecretKey()
Return true, if this object is an
OpenPGPKey , false otherwise. |
OpenPGPCertificate |
toCertificate()
Return the
OpenPGPCertificate of this OpenPGPKey . |
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
public OpenPGPKey(PGPSecretKeyRing keyRing)
OpenPGPKey
instance based on a PGPSecretKeyRing
.
The OpenPGPImplementation
will be acquired by invoking OpenPGPImplementation.getInstance()
.keyRing
- secret key ringpublic OpenPGPKey(PGPSecretKeyRing keyRing, OpenPGPImplementation implementation)
OpenPGPKey
instance based on a PGPSecretKeyRing
,
a provided OpenPGPImplementation
and its OpenPGPPolicy
.keyRing
- secret key ringimplementation
- OpenPGP implementationpublic OpenPGPKey(PGPSecretKeyRing keyRing, OpenPGPImplementation implementation, OpenPGPPolicy policy)
OpenPGPKey
instance based on a PGPSecretKeyRing
,
a provided OpenPGPImplementation
and OpenPGPPolicy
.keyRing
- secret key ringimplementation
- OpenPGP implementationpolicy
- OpenPGP policypublic boolean isSecretKey()
OpenPGPCertificate
OpenPGPKey
, false otherwise.isSecretKey
in class OpenPGPCertificate
public OpenPGPCertificate toCertificate()
OpenPGPCertificate
of this OpenPGPKey
.public java.util.List<OpenPGPCertificate.OpenPGPCertificateComponent> getComponents()
OpenPGPCertificate
List
containing all components
of the certificate.
Components are primary key, subkeys and identities (user-ids, user attributes).getComponents
in class OpenPGPCertificate
public OpenPGPKey.OpenPGPSecretKey getPrimarySecretKey()
OpenPGPKey.OpenPGPSecretKey
of this key's primary key.public java.util.Map<KeyIdentifier,OpenPGPKey.OpenPGPSecretKey> getSecretKeys()
Map
containing all OpenPGPKey.OpenPGPSecretKey
components (secret subkeys) of the key.public OpenPGPKey.OpenPGPSecretKey getSecretKey(KeyIdentifier identifier)
OpenPGPKey.OpenPGPSecretKey
identified by the passed KeyIdentifier
.identifier
- key identifierpublic OpenPGPKey.OpenPGPSecretKey getSecretKey(OpenPGPCertificate.OpenPGPComponentKey key)
OpenPGPKey.OpenPGPSecretKey
that corresponds to the passed OpenPGPComponentKey
.key
- component keypublic PGPSecretKeyRing getPGPKeyRing()
OpenPGPCertificate
PGPKeyRing
that this certificate is based on.getPGPKeyRing
in class OpenPGPCertificate
public PGPSecretKeyRing getPGPSecretKeyRing()
PGPSecretKeyRing
.public byte[] getEncoded(PacketFormat packetFormat) throws java.io.IOException
OpenPGPCertificate
getEncoded
in class OpenPGPCertificate
packetFormat
- packet length encoding formatjava.io.IOException
- if the certificate cannot be encoded