Class OpenPgpFingerprint

    • Field Detail

      • utf8

        protected static final Charset utf8
      • fingerprint

        protected final String fingerprint
    • Constructor Detail

      • OpenPgpFingerprint

        public OpenPgpFingerprint​(String fingerprint)
      • OpenPgpFingerprint

        public OpenPgpFingerprint​(@Nonnull
                                  byte[] bytes)
      • OpenPgpFingerprint

        public OpenPgpFingerprint​(org.bouncycastle.openpgp.PGPPublicKey key)
      • OpenPgpFingerprint

        public OpenPgpFingerprint​(@Nonnull
                                  org.bouncycastle.openpgp.PGPPublicKeyRing ring)
      • OpenPgpFingerprint

        public OpenPgpFingerprint​(@Nonnull
                                  org.bouncycastle.openpgp.PGPSecretKeyRing ring)
      • OpenPgpFingerprint

        public OpenPgpFingerprint​(@Nonnull
                                  org.bouncycastle.openpgp.PGPKeyRing ring)
    • Method Detail

      • of

        public static OpenPgpFingerprint of​(org.bouncycastle.openpgp.PGPPublicKey key)
        Return the fingerprint of the given key. This method automatically matches key versions to fingerprint implementations.
        Parameters:
        key - key
        Returns:
        fingerprint
      • of

        public static OpenPgpFingerprint of​(org.bouncycastle.openpgp.PGPKeyRing ring)
        Return the fingerprint of the primary key of the given key ring. This method automatically matches key versions to fingerprint implementations.
        Parameters:
        ring - key ring
        Returns:
        fingerprint
      • parseFromBinary

        public static OpenPgpFingerprint parseFromBinary​(byte[] binaryFingerprint)
        Parse a binary OpenPGP fingerprint into an OpenPgpFingerprint object.
        Parameters:
        binaryFingerprint - binary representation of the fingerprint
        Returns:
        parsed fingerprint
      • getVersion

        public abstract int getVersion()
        Return the version of the fingerprint.
        Returns:
        version
      • isValid

        protected abstract boolean isValid​(@Nonnull
                                           String fp)
        Check, whether the fingerprint consists of 40 valid hexadecimal characters.
        Parameters:
        fp - fingerprint to check.
        Returns:
        true if fingerprint is valid.
      • getKeyId

        public abstract long getKeyId()
        Return the key id of the OpenPGP public key this OpenPgpFingerprint belongs to. This method can be implemented for V4 and V5 fingerprints. V3 key-IDs cannot be derived from the fingerprint, but we don't care, since V3 is deprecated.
        Returns:
        key id
        See Also:
        RFC-4880 ยง12.2: Key IDs and Fingerprints
      • prettyPrint

        public abstract String prettyPrint()
        Return a pretty printed representation of the fingerprint.
        Returns:
        pretty printed fingerprint