diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java b/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java index 7c577600..a5e4d37b 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java @@ -407,8 +407,8 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface { } @Override - public PGPSignature createRevocationCertificate(@Nonnull SecretKeyRingProtector secretKeyRingProtector, - @Nullable RevocationAttributes revocationAttributes) + public PGPSignature createRevocation(@Nonnull SecretKeyRingProtector secretKeyRingProtector, + @Nullable RevocationAttributes revocationAttributes) throws PGPException { PGPPublicKey revokeeSubKey = secretKeyRing.getPublicKey(); PGPSignature revocationCertificate = generateRevocation( @@ -417,7 +417,7 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface { } @Override - public PGPSignature createRevocationCertificate( + public PGPSignature createRevocation( long subkeyId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) @@ -428,7 +428,7 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface { } @Override - public PGPSignature createRevocationCertificate( + public PGPSignature createRevocation( long subkeyId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationSignatureSubpackets.Callback certificateSubpacketsCallback) diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditorInterface.java b/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditorInterface.java index f09f25f3..b7d7af13 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditorInterface.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditorInterface.java @@ -462,6 +462,7 @@ public interface SecretKeyRingEditorInterface { /** * Create a detached revocation certificate, which can be used to revoke the whole key. + * The original key will not be modified by this method. * * @param secretKeyRingProtector protector to unlock the primary key. * @param revocationAttributes reason for the revocation @@ -469,13 +470,14 @@ public interface SecretKeyRingEditorInterface { * * @throws PGPException in case we cannot generate a revocation certificate */ - PGPSignature createRevocationCertificate( + PGPSignature createRevocation( @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) throws PGPException; /** * Create a detached revocation certificate, which can be used to revoke the specified subkey. + * The original key will not be modified by this method. * * @param subkeyId id of the subkey to be revoked * @param secretKeyRingProtector protector to unlock the primary key. @@ -484,7 +486,7 @@ public interface SecretKeyRingEditorInterface { * * @throws PGPException in case we cannot generate a revocation certificate */ - PGPSignature createRevocationCertificate( + PGPSignature createRevocation( long subkeyId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) @@ -492,6 +494,7 @@ public interface SecretKeyRingEditorInterface { /** * Create a detached revocation certificate, which can be used to revoke the specified subkey. + * The original key will not be modified by this method. * * @param subkeyId id of the subkey to be revoked * @param secretKeyRingProtector protector to unlock the primary key. @@ -500,7 +503,7 @@ public interface SecretKeyRingEditorInterface { * * @throws PGPException in case we cannot generate a revocation certificate */ - PGPSignature createRevocationCertificate( + PGPSignature createRevocation( long subkeyId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationSignatureSubpackets.Callback certificateSubpacketsCallback) @@ -508,6 +511,7 @@ public interface SecretKeyRingEditorInterface { /** * Create a detached revocation certificate, which can be used to revoke the specified subkey. + * The original key will not be modified by this method. * * @param subkeyFingerprint fingerprint of the subkey to be revoked * @param secretKeyRingProtector protector to unlock the primary key. @@ -516,13 +520,13 @@ public interface SecretKeyRingEditorInterface { * * @throws PGPException in case we cannot generate a revocation certificate */ - default PGPSignature createRevocationCertificate( + default PGPSignature createRevocation( OpenPgpFingerprint subkeyFingerprint, SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) throws PGPException { - return createRevocationCertificate( + return createRevocation( subkeyFingerprint.getKeyId(), secretKeyRingProtector, revocationAttributes); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevocationCertificateTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevocationCertificateTest.java index ec518847..21d732d9 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevocationCertificateTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevocationCertificateTest.java @@ -27,7 +27,7 @@ public class RevocationCertificateTest { PGPSecretKeyRing secretKeys = TestKeys.getEmilSecretKeyRing(); PGPSignature revocation = PGPainless.modifyKeyRing(secretKeys) - .createRevocationCertificate(SecretKeyRingProtector.unprotectedKeys(), + .createRevocation(SecretKeyRingProtector.unprotectedKeys(), RevocationAttributes.createKeyRevocation() .withReason(RevocationAttributes.Reason.KEY_RETIRED) .withoutDescription()); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java index 6a044199..ee6f0de3 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java @@ -75,7 +75,7 @@ public class RevokeSubKeyTest { SecretKeyRingProtector protector = PasswordBasedSecretKeyRingProtector.forKey(secretKeys, Passphrase.fromPassword("password123")); PGPSignature revocationCertificate = PGPainless.modifyKeyRing(secretKeys) - .createRevocationCertificate(fingerprint, protector, RevocationAttributes.createKeyRevocation() + .createRevocation(fingerprint, protector, RevocationAttributes.createKeyRevocation() .withReason(RevocationAttributes.Reason.KEY_RETIRED) .withDescription("Key no longer used.")); @@ -98,8 +98,8 @@ public class RevokeSubKeyTest { .forKey(secretKeys, Passphrase.fromPassword("password123")); SecretKeyRingEditorInterface editor = PGPainless.modifyKeyRing(secretKeys); - PGPSignature keyRevocation = editor.createRevocationCertificate(primaryKey.getKeyID(), protector, (RevocationAttributes) null); - PGPSignature subkeyRevocation = editor.createRevocationCertificate(subKey.getKeyID(), protector, (RevocationAttributes) null); + PGPSignature keyRevocation = editor.createRevocation(primaryKey.getKeyID(), protector, (RevocationAttributes) null); + PGPSignature subkeyRevocation = editor.createRevocation(subKey.getKeyID(), protector, (RevocationAttributes) null); assertEquals(SignatureType.KEY_REVOCATION.getCode(), keyRevocation.getSignatureType()); assertEquals(SignatureType.SUBKEY_REVOCATION.getCode(), subkeyRevocation.getSignatureType());