1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 22:32:07 +01:00

Add KeyRingInfo.getVersion()

This commit is contained in:
Paul Schaub 2021-06-26 16:30:54 +02:00
parent 98609375d1
commit dae5288456
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 11 additions and 0 deletions

View file

@ -727,6 +727,15 @@ public class KeyRingInfo {
return false; return false;
} }
/**
* Return the version number of the public keys format.
*
* @return version
*/
public int getVersion() {
return keys.getPublicKey().getVersion();
}
/** /**
* Return a list of all subkeys which can be used for encryption of the given purpose. * Return a list of all subkeys which can be used for encryption of the given purpose.
* This list does not include expired or revoked keys. * This list does not include expired or revoked keys.

View file

@ -75,6 +75,8 @@ public class KeyRingInfoTest {
assertEquals(Collections.singletonList("<emil@email.user>"), pInfo.getUserIds()); assertEquals(Collections.singletonList("<emil@email.user>"), pInfo.getUserIds());
assertEquals(Collections.singletonList("emil@email.user"), sInfo.getEmailAddresses()); assertEquals(Collections.singletonList("emil@email.user"), sInfo.getEmailAddresses());
assertEquals(Collections.singletonList("emil@email.user"), pInfo.getEmailAddresses()); assertEquals(Collections.singletonList("emil@email.user"), pInfo.getEmailAddresses());
assertEquals(4, sInfo.getVersion());
assertEquals(4, pInfo.getVersion());
assertTrue(sInfo.isSecretKey()); assertTrue(sInfo.isSecretKey());
assertFalse(pInfo.isSecretKey()); assertFalse(pInfo.isSecretKey());