Class Key
- java.lang.Object
-
- pgp.certificate_store.certificate.Key
-
- All Implemented Interfaces:
KeyMaterial
public class Key extends java.lang.Object implements KeyMaterial
OpenPGP key (secret key).
-
-
Constructor Summary
Constructors Constructor Description Key(byte[] bytes, Certificate certificate, java.lang.Long tag)Key constructor.Key(Key key, java.lang.Long tag)Copy constructor to change the tag of both theKeyand itsCertificate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CertificateasCertificate()Return theCertificatebelonging to this key material.CertificategetCertificate()Return the certificate part of this OpenPGP key.java.lang.StringgetFingerprint()Return the fingerprint of the certificate as 40 lowercase hex characters.java.io.InputStreamgetInputStream()Return anInputStreamof the binary representation of the secret key.java.util.List<java.lang.Long>getSubkeyIds()Return aSetcontaining key-ids of subkeys.java.lang.LonggetTag()Return the tag belonging to this key material.
-
-
-
Constructor Detail
-
Key
public Key(byte[] bytes, Certificate certificate, java.lang.Long tag)Key constructor.- Parameters:
bytes- encoding of the keycertificate- associated certificatetag- tag
-
Key
public Key(Key key, java.lang.Long tag)
Copy constructor to change the tag of both theKeyand itsCertificate.- Parameters:
key- keytag- tag
-
-
Method Detail
-
getCertificate
public Certificate getCertificate()
Return the certificate part of this OpenPGP key.- Returns:
- OpenPGP certificate
-
getFingerprint
public java.lang.String getFingerprint()
Description copied from interface:KeyMaterialReturn the fingerprint of the certificate as 40 lowercase hex characters. TODO: Allow OpenPGP V5 fingerprints- Specified by:
getFingerprintin interfaceKeyMaterial- Returns:
- fingerprint
-
asCertificate
public Certificate asCertificate()
Description copied from interface:KeyMaterialReturn theCertificatebelonging to this key material. If this is already aCertificate, return this. If this is aKey, extract theCertificateand return it.- Specified by:
asCertificatein interfaceKeyMaterial- Returns:
- certificate
-
getInputStream
public java.io.InputStream getInputStream()
Description copied from interface:KeyMaterialReturn anInputStreamof the binary representation of the secret key.- Specified by:
getInputStreamin interfaceKeyMaterial- Returns:
- input stream
-
getTag
public java.lang.Long getTag()
Description copied from interface:KeyMaterialReturn the tag belonging to this key material. The tag can be used to keep an application cache in sync with what is in the directory.- Specified by:
getTagin interfaceKeyMaterial- Returns:
- tag
-
getSubkeyIds
public java.util.List<java.lang.Long> getSubkeyIds()
Description copied from interface:KeyMaterialReturn aSetcontaining key-ids of subkeys.- Specified by:
getSubkeyIdsin interfaceKeyMaterial- Returns:
- subkeys
-
-