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

Test v6 key revocation

This commit is contained in:
Paul Schaub 2025-05-15 14:58:24 +02:00
parent 946d8aace0
commit 4e5eff6113
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -0,0 +1,44 @@
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.sop;
import org.bouncycastle.openpgp.api.OpenPGPCertificate;
import org.bouncycastle.openpgp.api.OpenPGPKey;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.OpenPGPKeyVersion;
import sop.SOP;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class RevokeKeyTest {
private static SOP sop;
@BeforeAll
public static void setup() {
sop = new SOPImpl();
}
@Test
public void revokeV6CertResultsInMinimalRevCert() throws IOException {
PGPainless api = PGPainless.getInstance();
OpenPGPKey v6Key = api.generateKey(OpenPGPKeyVersion.v6)
.modernKeyRing("Alice <alice@pgpainless.org>");
assertEquals(3, v6Key.getKeys().size());
byte[] revoked = sop.revokeKey()
.keys(v6Key.getEncoded())
.getBytes();
OpenPGPCertificate revocationCert = api.readKey().parseCertificate(revoked);
assertEquals(1, revocationCert.getKeys().size(),
"V6 keys are revoked using a minimal revocation cert," +
" consisting only of the primary key and a rev sig.");
}
}