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.String
SCHEME
-
Constructor Summary
Constructors Constructor Description OpenPgpV4Fingerprint(byte[] bytes)
OpenPgpV4Fingerprint(java.lang.String fingerprint)
Create anOpenPgpV4Fingerprint
.OpenPgpV4Fingerprint(org.bouncycastle.openpgp.PGPKeyRing ring)
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 char
charAt(int i)
int
compareTo(OpenPgpV4Fingerprint openPgpV4Fingerprint)
boolean
equals(java.lang.Object other)
static OpenPgpV4Fingerprint
fromUri(java.net.URI uri)
Convert a openpgp4fpr URI to anOpenPgpV4Fingerprint
.long
getKeyId()
Return the key id of the OpenPGP public key thisOpenPgpV4Fingerprint
belongs to.int
hashCode()
int
length()
java.lang.String
prettyPrint()
java.lang.CharSequence
subSequence(int i, int i1)
java.lang.String
toString()
java.net.URI
toUri()
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)
-
OpenPgpV4Fingerprint
public OpenPgpV4Fingerprint(@Nonnull org.bouncycastle.openpgp.PGPKeyRing ring)
-
-
Method Detail
-
getKeyId
public long getKeyId()
Return the key id of the OpenPGP public key thisOpenPgpV4Fingerprint
belongs to.- Returns:
- key id
- See Also:
- RFC-4880 §12.2: Key IDs and Fingerprints
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
length
public int length()
- Specified by:
length
in interfacejava.lang.CharSequence
-
charAt
public char charAt(int i)
- Specified by:
charAt
in interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int i, int i1)
- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
toString
@Nonnull public java.lang.String toString()
- Specified by:
toString
in interfacejava.lang.CharSequence
- Overrides:
toString
in classjava.lang.Object
-
prettyPrint
public java.lang.String prettyPrint()
-
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
-URI
with scheme 'openpgp4fpr'- Returns:
- fingerprint parsed from the uri
- See Also:
- openpgp4fpr URI scheme
-
compareTo
public int compareTo(@Nonnull OpenPgpV4Fingerprint openPgpV4Fingerprint)
- Specified by:
compareTo
in interfacejava.lang.Comparable<OpenPgpV4Fingerprint>
-
-