Skip to content

Commit 3541463

Browse files
committed
added tests for partial matching on keyID, relates to github #1868
1 parent d7afc76 commit 3541463

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pg/src/test/java/org/bouncycastle/openpgp/test/KeyIdentifierTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ private void testMatchV4Key()
126126
isTrue(primaryIdentifier.matches(privateKey.getKeyIdentifier(new JcaKeyFingerprintCalculator())));
127127
isTrue(!subkeyIdentifier.matches(privateKey.getKeyIdentifier(new JcaKeyFingerprintCalculator())));
128128

129+
KeyIdentifier noFingerPrintId = new KeyIdentifier(primaryKey.getKeyID());
130+
isTrue(primaryKey.getKeyIdentifier().matches(noFingerPrintId));
131+
129132
KeyIdentifier wildcard = KeyIdentifier.wildcard();
130133
isTrue(wildcard.matches(primaryKey.getKeyIdentifier()));
131134
isTrue(wildcard.matches(subkey.getKeyIdentifier()));
@@ -172,6 +175,9 @@ private void testMatchV6Key()
172175
isTrue(primaryIdentifier.matches(privateKey.getKeyIdentifier(new BcKeyFingerprintCalculator())));
173176
isTrue(!subkeyIdentifier.matches(privateKey.getKeyIdentifier(new BcKeyFingerprintCalculator())));
174177

178+
KeyIdentifier noFingerPrintId = new KeyIdentifier(primaryKey.getKeyID());
179+
isTrue(primaryKey.getKeyIdentifier().matches(noFingerPrintId));
180+
175181
KeyIdentifier wildcard = KeyIdentifier.wildcard();
176182
isTrue(wildcard.matches(primaryKey.getKeyIdentifier()));
177183
isTrue(wildcard.matches(subkey.getKeyIdentifier()));

0 commit comments

Comments
 (0)