Package org.pgpainless.key
Class OpenPgpV4Fingerprint
- java.lang.Object
-
- org.pgpainless.key.OpenPgpV4Fingerprint
-
- All Implemented Interfaces:
java.lang.CharSequence,java.lang.Comparable<OpenPgpV4Fingerprint>
public class OpenPgpV4Fingerprint extends java.lang.Object implements java.lang.CharSequence, java.lang.Comparable<OpenPgpV4Fingerprint>
This class represents an hex encoded, uppercase OpenPGP v4 fingerprint.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSCHEME
-
Constructor Summary
Constructors Constructor Description OpenPgpV4Fingerprint(byte[] bytes)OpenPgpV4Fingerprint(java.lang.String fingerprint)Create anOpenPgpV4Fingerprint.OpenPgpV4Fingerprint(org.bouncycastle.openpgp.PGPPublicKey key)OpenPgpV4Fingerprint(org.bouncycastle.openpgp.PGPPublicKeyRing ring)OpenPgpV4Fingerprint(org.bouncycastle.openpgp.PGPSecretKey key)OpenPgpV4Fingerprint(org.bouncycastle.openpgp.PGPSecretKeyRing ring)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description charcharAt(int i)intcompareTo(OpenPgpV4Fingerprint openPgpV4Fingerprint)booleanequals(java.lang.Object other)static OpenPgpV4FingerprintfromUri(java.net.URI uri)Convert a openpgp4fpr URI to anOpenPgpV4Fingerprint.longgetKeyId()Return the key id of the OpenPGP public key thisOpenPgpV4Fingerprintbelongs to.inthashCode()intlength()java.lang.CharSequencesubSequence(int i, int i1)java.lang.StringtoString()java.net.URItoUri()Return the fingerprint as an openpgp4fprURI.
-
-
-
Field Detail
-
SCHEME
public static final java.lang.String SCHEME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OpenPgpV4Fingerprint
public OpenPgpV4Fingerprint(@Nonnull java.lang.String fingerprint)Create anOpenPgpV4Fingerprint.- Parameters:
fingerprint- hexadecimal representation of the fingerprint.- See Also:
- XEP-0373 §4.1: The OpenPGP Public-Key Data Node about how to obtain the fingerprint
-
OpenPgpV4Fingerprint
public OpenPgpV4Fingerprint(@Nonnull byte[] bytes)
-
OpenPgpV4Fingerprint
public OpenPgpV4Fingerprint(@Nonnull org.bouncycastle.openpgp.PGPPublicKey key)
-
OpenPgpV4Fingerprint
public OpenPgpV4Fingerprint(@Nonnull org.bouncycastle.openpgp.PGPSecretKey key)
-
OpenPgpV4Fingerprint
public OpenPgpV4Fingerprint(@Nonnull org.bouncycastle.openpgp.PGPPublicKeyRing ring)
-
OpenPgpV4Fingerprint
public OpenPgpV4Fingerprint(@Nonnull org.bouncycastle.openpgp.PGPSecretKeyRing ring)
-
-
Method Detail
-
getKeyId
public long getKeyId()
Return the key id of the OpenPGP public key thisOpenPgpV4Fingerprintbelongs to.- Returns:
- key id
- See Also:
- RFC-4880 §12.2: Key IDs and Fingerprints
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
length
public int length()
- Specified by:
lengthin interfacejava.lang.CharSequence
-
charAt
public char charAt(int i)
- Specified by:
charAtin interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int i, int i1)- Specified by:
subSequencein interfacejava.lang.CharSequence
-
toString
@Nonnull public java.lang.String toString()
- Specified by:
toStringin interfacejava.lang.CharSequence- Overrides:
toStringin classjava.lang.Object
-
toUri
public java.net.URI toUri()
Return the fingerprint as an openpgp4fprURI. An example would be 'openpgp4fpr:7F9116FEA90A5983936C7CFAA027DB2F3E1E118A'.- Returns:
- openpgp4fpr fingerprint uri
- See Also:
- openpgp4fpr URI scheme
-
fromUri
public static OpenPgpV4Fingerprint fromUri(java.net.URI uri)
Convert a openpgp4fpr URI to anOpenPgpV4Fingerprint.- Parameters:
uri-URIwith scheme 'openpgp4fpr'- Returns:
- fingerprint parsed from the uri
- See Also:
- openpgp4fpr URI scheme
-
compareTo
public int compareTo(@Nonnull OpenPgpV4Fingerprint openPgpV4Fingerprint)- Specified by:
compareToin interfacejava.lang.Comparable<OpenPgpV4Fingerprint>
-
-