mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-18 02:12:06 +01:00
Rename SecretKeyRingEditor.createRevocationCertificate() to createRevocation()
This commit is contained in:
parent
600d5f49bb
commit
2a7c6af022
4 changed files with 17 additions and 13 deletions
|
@ -407,7 +407,7 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PGPSignature createRevocationCertificate(@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
public PGPSignature createRevocation(@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
||||||
@Nullable RevocationAttributes revocationAttributes)
|
@Nullable RevocationAttributes revocationAttributes)
|
||||||
throws PGPException {
|
throws PGPException {
|
||||||
PGPPublicKey revokeeSubKey = secretKeyRing.getPublicKey();
|
PGPPublicKey revokeeSubKey = secretKeyRing.getPublicKey();
|
||||||
|
@ -417,7 +417,7 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PGPSignature createRevocationCertificate(
|
public PGPSignature createRevocation(
|
||||||
long subkeyId,
|
long subkeyId,
|
||||||
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
||||||
@Nullable RevocationAttributes revocationAttributes)
|
@Nullable RevocationAttributes revocationAttributes)
|
||||||
|
@ -428,7 +428,7 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PGPSignature createRevocationCertificate(
|
public PGPSignature createRevocation(
|
||||||
long subkeyId,
|
long subkeyId,
|
||||||
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
||||||
@Nullable RevocationSignatureSubpackets.Callback certificateSubpacketsCallback)
|
@Nullable RevocationSignatureSubpackets.Callback certificateSubpacketsCallback)
|
||||||
|
|
|
@ -462,6 +462,7 @@ public interface SecretKeyRingEditorInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a detached revocation certificate, which can be used to revoke the whole key.
|
* 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 secretKeyRingProtector protector to unlock the primary key.
|
||||||
* @param revocationAttributes reason for the revocation
|
* @param revocationAttributes reason for the revocation
|
||||||
|
@ -469,13 +470,14 @@ public interface SecretKeyRingEditorInterface {
|
||||||
*
|
*
|
||||||
* @throws PGPException in case we cannot generate a revocation certificate
|
* @throws PGPException in case we cannot generate a revocation certificate
|
||||||
*/
|
*/
|
||||||
PGPSignature createRevocationCertificate(
|
PGPSignature createRevocation(
|
||||||
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
||||||
@Nullable RevocationAttributes revocationAttributes)
|
@Nullable RevocationAttributes revocationAttributes)
|
||||||
throws PGPException;
|
throws PGPException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a detached revocation certificate, which can be used to revoke the specified subkey.
|
* 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 subkeyId id of the subkey to be revoked
|
||||||
* @param secretKeyRingProtector protector to unlock the primary key.
|
* @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
|
* @throws PGPException in case we cannot generate a revocation certificate
|
||||||
*/
|
*/
|
||||||
PGPSignature createRevocationCertificate(
|
PGPSignature createRevocation(
|
||||||
long subkeyId,
|
long subkeyId,
|
||||||
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
||||||
@Nullable RevocationAttributes revocationAttributes)
|
@Nullable RevocationAttributes revocationAttributes)
|
||||||
|
@ -492,6 +494,7 @@ public interface SecretKeyRingEditorInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a detached revocation certificate, which can be used to revoke the specified subkey.
|
* 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 subkeyId id of the subkey to be revoked
|
||||||
* @param secretKeyRingProtector protector to unlock the primary key.
|
* @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
|
* @throws PGPException in case we cannot generate a revocation certificate
|
||||||
*/
|
*/
|
||||||
PGPSignature createRevocationCertificate(
|
PGPSignature createRevocation(
|
||||||
long subkeyId,
|
long subkeyId,
|
||||||
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
@Nonnull SecretKeyRingProtector secretKeyRingProtector,
|
||||||
@Nullable RevocationSignatureSubpackets.Callback certificateSubpacketsCallback)
|
@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.
|
* 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 subkeyFingerprint fingerprint of the subkey to be revoked
|
||||||
* @param secretKeyRingProtector protector to unlock the primary key.
|
* @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
|
* @throws PGPException in case we cannot generate a revocation certificate
|
||||||
*/
|
*/
|
||||||
default PGPSignature createRevocationCertificate(
|
default PGPSignature createRevocation(
|
||||||
OpenPgpFingerprint subkeyFingerprint,
|
OpenPgpFingerprint subkeyFingerprint,
|
||||||
SecretKeyRingProtector secretKeyRingProtector,
|
SecretKeyRingProtector secretKeyRingProtector,
|
||||||
@Nullable RevocationAttributes revocationAttributes)
|
@Nullable RevocationAttributes revocationAttributes)
|
||||||
throws PGPException {
|
throws PGPException {
|
||||||
|
|
||||||
return createRevocationCertificate(
|
return createRevocation(
|
||||||
subkeyFingerprint.getKeyId(),
|
subkeyFingerprint.getKeyId(),
|
||||||
secretKeyRingProtector,
|
secretKeyRingProtector,
|
||||||
revocationAttributes);
|
revocationAttributes);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class RevocationCertificateTest {
|
||||||
PGPSecretKeyRing secretKeys = TestKeys.getEmilSecretKeyRing();
|
PGPSecretKeyRing secretKeys = TestKeys.getEmilSecretKeyRing();
|
||||||
|
|
||||||
PGPSignature revocation = PGPainless.modifyKeyRing(secretKeys)
|
PGPSignature revocation = PGPainless.modifyKeyRing(secretKeys)
|
||||||
.createRevocationCertificate(SecretKeyRingProtector.unprotectedKeys(),
|
.createRevocation(SecretKeyRingProtector.unprotectedKeys(),
|
||||||
RevocationAttributes.createKeyRevocation()
|
RevocationAttributes.createKeyRevocation()
|
||||||
.withReason(RevocationAttributes.Reason.KEY_RETIRED)
|
.withReason(RevocationAttributes.Reason.KEY_RETIRED)
|
||||||
.withoutDescription());
|
.withoutDescription());
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class RevokeSubKeyTest {
|
||||||
SecretKeyRingProtector protector = PasswordBasedSecretKeyRingProtector.forKey(secretKeys, Passphrase.fromPassword("password123"));
|
SecretKeyRingProtector protector = PasswordBasedSecretKeyRingProtector.forKey(secretKeys, Passphrase.fromPassword("password123"));
|
||||||
|
|
||||||
PGPSignature revocationCertificate = PGPainless.modifyKeyRing(secretKeys)
|
PGPSignature revocationCertificate = PGPainless.modifyKeyRing(secretKeys)
|
||||||
.createRevocationCertificate(fingerprint, protector, RevocationAttributes.createKeyRevocation()
|
.createRevocation(fingerprint, protector, RevocationAttributes.createKeyRevocation()
|
||||||
.withReason(RevocationAttributes.Reason.KEY_RETIRED)
|
.withReason(RevocationAttributes.Reason.KEY_RETIRED)
|
||||||
.withDescription("Key no longer used."));
|
.withDescription("Key no longer used."));
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ public class RevokeSubKeyTest {
|
||||||
.forKey(secretKeys, Passphrase.fromPassword("password123"));
|
.forKey(secretKeys, Passphrase.fromPassword("password123"));
|
||||||
|
|
||||||
SecretKeyRingEditorInterface editor = PGPainless.modifyKeyRing(secretKeys);
|
SecretKeyRingEditorInterface editor = PGPainless.modifyKeyRing(secretKeys);
|
||||||
PGPSignature keyRevocation = editor.createRevocationCertificate(primaryKey.getKeyID(), protector, (RevocationAttributes) null);
|
PGPSignature keyRevocation = editor.createRevocation(primaryKey.getKeyID(), protector, (RevocationAttributes) null);
|
||||||
PGPSignature subkeyRevocation = editor.createRevocationCertificate(subKey.getKeyID(), protector, (RevocationAttributes) null);
|
PGPSignature subkeyRevocation = editor.createRevocation(subKey.getKeyID(), protector, (RevocationAttributes) null);
|
||||||
|
|
||||||
assertEquals(SignatureType.KEY_REVOCATION.getCode(), keyRevocation.getSignatureType());
|
assertEquals(SignatureType.KEY_REVOCATION.getCode(), keyRevocation.getSignatureType());
|
||||||
assertEquals(SignatureType.SUBKEY_REVOCATION.getCode(), subkeyRevocation.getSignatureType());
|
assertEquals(SignatureType.SUBKEY_REVOCATION.getCode(), subkeyRevocation.getSignatureType());
|
||||||
|
|
Loading…
Reference in a new issue