File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
main/java/org/bouncycastle/bcpg
test/java/org/bouncycastle/openpgp/test Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,14 @@ public KeyIdentifier(String hexEncoded)
32
32
*/
33
33
public KeyIdentifier (byte [] fingerprint )
34
34
{
35
+ // Long KeyID
36
+ if (fingerprint .length == 8 )
37
+ {
38
+ keyId = FingerprintUtil .longFromRightMostBytes (fingerprint );
39
+ this .fingerprint = null ;
40
+ return ;
41
+ }
42
+
35
43
this .fingerprint = Arrays .clone (fingerprint );
36
44
37
45
// v4
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ public void performTest()
39
39
testWildcardIdentifier ();
40
40
testIdentifierFromKeyId ();
41
41
42
+ testIdentifierFromLongKeyId ();
43
+
42
44
testIdentifierFromV4Fingerprint ();
43
45
testIdentifierFromV6Fingerprint ();
44
46
@@ -70,6 +72,17 @@ private void testIdentifierFromKeyId()
70
72
isEquals ("1234" , identifier .toString ());
71
73
}
72
74
75
+ private void testIdentifierFromLongKeyId ()
76
+ {
77
+ isEquals (5145070902336167606L , new KeyIdentifier ("4766F6B9D5F21EB6" ).getKeyId ());
78
+ isEquals (5145070902336167606L , new KeyIdentifier ("4766f6b9d5f21eb6" ).getKeyId ());
79
+
80
+ isEquals (5507497285755629956L , new KeyIdentifier ("4C6E8F99F6E47184" ).getKeyId ());
81
+ isEquals (1745434690267590572L , new KeyIdentifier ("1839079A640B2FAC" ).getKeyId ());
82
+
83
+ isTrue (new KeyIdentifier ("1839079A640B2FAC" ).getFingerprint () == null );
84
+ }
85
+
73
86
private void testIdentifierFromV4Fingerprint ()
74
87
{
75
88
String hexFingerprint = "D1A66E1A23B182C9980F788CFBFCC82A015E7330" ;
You can’t perform that action at this time.
0 commit comments