Class 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 the Key and its Certificate.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Certificate asCertificate()
      Return the Certificate belonging to this key material.
      Certificate getCertificate()
      Return the certificate part of this OpenPGP key.
      java.lang.String getFingerprint()
      Return the fingerprint of the certificate as 40 lowercase hex characters.
      java.io.InputStream getInputStream()
      Return an InputStream of the binary representation of the secret key.
      java.util.List<java.lang.Long> getSubkeyIds()
      Return a Set containing key-ids of subkeys.
      java.lang.Long getTag()
      Return the tag belonging to this key material.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Key

        public Key​(byte[] bytes,
                   Certificate certificate,
                   java.lang.Long tag)
        Key constructor.
        Parameters:
        bytes - encoding of the key
        certificate - associated certificate
        tag - tag
      • Key

        public Key​(Key key,
                   java.lang.Long tag)
        Copy constructor to change the tag of both the Key and its Certificate.
        Parameters:
        key - key
        tag - 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: KeyMaterial
        Return the fingerprint of the certificate as 40 lowercase hex characters. TODO: Allow OpenPGP V5 fingerprints
        Specified by:
        getFingerprint in interface KeyMaterial
        Returns:
        fingerprint
      • getInputStream

        public java.io.InputStream getInputStream()
        Description copied from interface: KeyMaterial
        Return an InputStream of the binary representation of the secret key.
        Specified by:
        getInputStream in interface KeyMaterial
        Returns:
        input stream
      • getTag

        public java.lang.Long getTag()
        Description copied from interface: KeyMaterial
        Return 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:
        getTag in interface KeyMaterial
        Returns:
        tag
      • getSubkeyIds

        public java.util.List<java.lang.Long> getSubkeyIds()
        Description copied from interface: KeyMaterial
        Return a Set containing key-ids of subkeys.
        Specified by:
        getSubkeyIds in interface KeyMaterial
        Returns:
        subkeys