mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 10:49:39 +02:00
Initial implementation of the new revoke-key command from SOP-07
This commit is contained in:
parent
556d1bee30
commit
37bbe8bb39
5 changed files with 163 additions and 1 deletions
|
@ -0,0 +1,40 @@
|
|||
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package sop.testsuite.pgpainless.operation;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bouncycastle.openpgp.PGPKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.key.info.KeyRingInfo;
|
||||
import sop.SOP;
|
||||
import sop.testsuite.operation.RevokeKeyTest;
|
||||
|
||||
public class PGPainlessRevokeKeyTest extends RevokeKeyTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideInstances") // from sop-java's RevokeKeyTest class
|
||||
@Override
|
||||
public void revokeUnprotectedKey(SOP sop) throws IOException {
|
||||
super.revokeUnprotectedKey(sop);
|
||||
|
||||
byte[] key = sop.generateKey().generate().getBytes();
|
||||
byte[] revokedKey = sop.revokeKey().keys(key).getBytes();
|
||||
|
||||
PGPKeyRing certificate = PGPainless.readKeyRing().keyRing(revokedKey);
|
||||
assertFalse(certificate instanceof PGPSecretKeyRing);
|
||||
assertTrue(certificate instanceof PGPPublicKeyRing);
|
||||
|
||||
KeyRingInfo info = PGPainless.inspectKeyRing(certificate);
|
||||
assertTrue(info.getRevocationState().isSoftRevocation());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue