1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 10:49:39 +02:00

Further integration of OpenPGPCertificate into KeyRingInfo

This commit is contained in:
Paul Schaub 2025-02-05 09:56:56 +01:00
parent 6f2716eb34
commit dc3f9795fd
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
5 changed files with 65 additions and 31 deletions

View file

@ -54,7 +54,7 @@ public class ModifyKeys {
.modernKeyRing(userId, originalPassphrase);
KeyRingInfo info = PGPainless.inspectKeyRing(secretKey);
primaryKeyId = info.getKeyId();
primaryKeyId = info.getKeyIdentifier().getKeyId();
encryptionSubkeyId = info.getEncryptionSubkeys(EncryptionPurpose.ANY).get(0).getKeyID();
signingSubkeyId = info.getSigningSubkeys().get(0).getKeyID();
}

View file

@ -15,6 +15,7 @@ import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import org.bouncycastle.bcpg.KeyIdentifier;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
@ -53,9 +54,9 @@ public class GenerateKeyWithoutPrimaryKeyFlagsTest {
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
assertTrue(info.getValidUserIds().contains("Alice"));
long primaryKeyId = info.getKeyId();
KeyIdentifier primaryKeyIdentifier = info.getKeyIdentifier();
assertTrue(info.getKeyFlagsOf("Alice").isEmpty());
assertTrue(info.getKeyFlagsOf(primaryKeyId).isEmpty());
assertTrue(info.getKeyFlagsOf(primaryKeyIdentifier).isEmpty());
assertFalse(info.isUsableForThirdPartyCertification());
// Key without CERTIFY_OTHER flag cannot be used to certify other keys

View file

@ -66,8 +66,8 @@ public class KeyRingInfoTest {
KeyRingInfo sInfo = PGPainless.inspectKeyRing(secretKeys);
KeyRingInfo pInfo = PGPainless.inspectKeyRing(publicKeys);
assertEquals(TestKeys.EMIL_KEY_ID, sInfo.getKeyId());
assertEquals(TestKeys.EMIL_KEY_ID, pInfo.getKeyId());
assertEquals(TestKeys.EMIL_KEY_ID, sInfo.getKeyIdentifier().getKeyId());
assertEquals(TestKeys.EMIL_KEY_ID, pInfo.getKeyIdentifier().getKeyId());
assertEquals(TestKeys.EMIL_FINGERPRINT, sInfo.getFingerprint());
assertEquals(TestKeys.EMIL_FINGERPRINT, pInfo.getFingerprint());
assertEquals(PublicKeyAlgorithm.ECDSA, sInfo.getAlgorithm());

View file

@ -90,7 +90,7 @@ public class FixUserIdDoesNotBreakEncryptionCapabilityTest {
assertEquals(userIdBefore, before.getPrimaryUserId());
assertEquals(userIdAfter, after.getPrimaryUserId());
assertTrue(after.isKeyValidlyBound(after.getKeyId()));
assertTrue(after.isKeyValidlyBound(after.getKeyIdentifier()));
assertTrue(before.isUsableForEncryption());
assertTrue(before.isUsableForSigning());
assertTrue(before.isUserIdValid(userIdBefore));