mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-10 06:11:08 +01:00
Add and test OpenPgpFingerprint.parseFromBinary(bytes)
This commit is contained in:
parent
3a9bfd57ac
commit
9921fc6ff6
3 changed files with 90 additions and 0 deletions
|
|
@ -67,6 +67,17 @@ public abstract class OpenPgpFingerprint implements CharSequence, Comparable<Ope
|
|||
throw new IllegalArgumentException("Fingerprint does not appear to match any known fingerprint patterns.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a binary OpenPGP fingerprint into an {@link OpenPgpFingerprint} object.
|
||||
*
|
||||
* @param binaryFingerprint
|
||||
* @return
|
||||
*/
|
||||
public static OpenPgpFingerprint parseFromBinary(byte[] binaryFingerprint) {
|
||||
String hex = Hex.toHexString(binaryFingerprint).toUpperCase();
|
||||
return parse(hex);
|
||||
}
|
||||
|
||||
public OpenPgpFingerprint(String fingerprint) {
|
||||
String fp = fingerprint.replace(" ", "").trim().toUpperCase();
|
||||
if (!isValid(fp)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue