public class FingerprintUtil
extends java.lang.Object
Constructor and Description |
---|
FingerprintUtil() |
Modifier and Type | Method and Description |
---|---|
static long |
keyIdFromFingerprint(int keyVersion,
byte[] fingerprint)
Derive a key-id from the given key fingerprint.
|
static long |
keyIdFromLibrePgpFingerprint(byte[] v5Fingerprint)
Derive a 64 bit key-id from a version 5 LibrePGP fingerprint.
|
static long |
keyIdFromV4Fingerprint(byte[] v4Fingerprint)
Derive a 64 bit key-id from a version 4 OpenPGP fingerprint.
|
static long |
keyIdFromV6Fingerprint(byte[] v6Fingerprint)
Derive a 64 bit key-id from a version 6 OpenPGP fingerprint.
|
static long |
longFromLeftMostBytes(byte[] bytes)
Convert the left-most 8 bytes from the given array to a long.
|
static long |
longFromRightMostBytes(byte[] bytes)
Convert the right-most 8 bytes from the given array to a long.
|
static java.lang.String |
prettifyFingerprint(byte[] fingerprint) |
static long |
readKeyID(byte[] bytes)
Read a key-ID from the first 8 octets of the given byte array.
|
static long |
readKeyID(byte[] bytes,
int offset)
Read a key-ID from 8 octets of the given byte array starting at offset.
|
static void |
writeKeyID(long keyID,
byte[] bytes)
Write the key-ID to the first 8 octets of the given byte array.
|
static void |
writeKeyID(long keyID,
byte[] bytes,
int offset)
Write the key-ID encoded as 8 octets to the given byte array, starting at index offset.
|
public static long keyIdFromFingerprint(int keyVersion, byte[] fingerprint)
keyVersion
- version of the keyfingerprint
- fingerprint of the keypublic static long keyIdFromV6Fingerprint(byte[] v6Fingerprint)
v6Fingerprint
- 32 byte fingerprintpublic static long keyIdFromLibrePgpFingerprint(byte[] v5Fingerprint)
v5Fingerprint
- 32 byte fingerprintpublic static long keyIdFromV4Fingerprint(byte[] v4Fingerprint)
v4Fingerprint
- 20 byte fingerprintpublic static long longFromLeftMostBytes(byte[] bytes)
bytes
- bytespublic static long longFromRightMostBytes(byte[] bytes)
bytes
- bytespublic static long readKeyID(byte[] bytes)
bytes
- byte arraypublic static long readKeyID(byte[] bytes, int offset)
bytes
- byte arrayoffset
- offsetpublic static void writeKeyID(long keyID, byte[] bytes, int offset)
keyID
- keyIDbytes
- byte arrayoffset
- starting offsetpublic static void writeKeyID(long keyID, byte[] bytes)
keyID
- keyIDbytes
- byte arraypublic static java.lang.String prettifyFingerprint(byte[] fingerprint)