1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 22:32:07 +01:00

Parametrize BindingSignatureSubpacketsTest to run on all implementations

This commit is contained in:
Paul Schaub 2021-07-03 12:50:44 +02:00
parent b4b84badc0
commit 7c612dd2ef
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -27,9 +27,11 @@ import java.util.Date;
import org.bouncycastle.openpgp.PGPException; import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing; import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSignature; import org.bouncycastle.openpgp.PGPSignature;
import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.pgpainless.PGPainless; import org.pgpainless.PGPainless;
import org.pgpainless.exception.SignatureValidationException; import org.pgpainless.exception.SignatureValidationException;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.policy.Policy; import org.pgpainless.policy.Policy;
/** /**
@ -59,8 +61,11 @@ public class BindingSignatureSubpacketsTest {
private Date validationDate = new Date(); private Date validationDate = new Date();
private Policy policy = PGPainless.getPolicy(); private Policy policy = PGPainless.getPolicy();
@Test @ParameterizedTest
public void baseCase() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void baseCase(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -118,8 +123,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Base case. Is valid."); expectSignatureValidationSucceeds(key, "Base case. Is valid.");
} }
@Test @ParameterizedTest
public void subkeyBindingIssuerFpOnly() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingIssuerFpOnly(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -177,8 +185,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Interoperability concern."); expectSignatureValidationSucceeds(key, "Interoperability concern.");
} }
@Test @ParameterizedTest
public void subkeyBindingIssuerV6IssuerFp() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingIssuerV6IssuerFp(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -236,8 +247,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Interoperability concern"); expectSignatureValidationSucceeds(key, "Interoperability concern");
} }
@Test @ParameterizedTest
public void subkeyBindingIssuerFakeIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingIssuerFakeIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -295,8 +309,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Interoperability concern."); expectSignatureValidationSucceeds(key, "Interoperability concern.");
} }
@Test @ParameterizedTest
public void subkeyBindingFakeIssuerIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingFakeIssuerIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -354,8 +371,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Interop concern"); expectSignatureValidationSucceeds(key, "Interop concern");
} }
@Test @ParameterizedTest
public void subkeyBindingFakeIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingFakeIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -413,8 +433,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "fake issuers do not throw us off here."); expectSignatureValidationSucceeds(key, "fake issuers do not throw us off here.");
} }
@Test @ParameterizedTest
public void subkeyBindingNoIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingNoIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -471,8 +494,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "subkey binding sig does not need issuer"); expectSignatureValidationSucceeds(key, "subkey binding sig does not need issuer");
} }
@Test @ParameterizedTest
public void unknownSubpacketHashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void unknownSubpacketHashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -530,8 +556,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown subpackets are okay in hashed area"); expectSignatureValidationSucceeds(key, "Unknown subpackets are okay in hashed area");
} }
@Test @ParameterizedTest
public void subkeyBindingUnknownCriticalSubpacket() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingUnknownCriticalSubpacket(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -589,8 +618,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationFails(key, "Unknown critical subpacket in hashed area invalidates signature"); expectSignatureValidationFails(key, "Unknown critical subpacket in hashed area invalidates signature");
} }
@Test @ParameterizedTest
public void subkeyBindingUnknownSubpacketUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingUnknownSubpacketUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -648,8 +680,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown subpackets may be allowed in unhashed area."); expectSignatureValidationSucceeds(key, "Unknown subpackets may be allowed in unhashed area.");
} }
@Test @ParameterizedTest
public void subkeyBindingUnknownCriticalSubpacketUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingUnknownCriticalSubpacketUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -707,8 +742,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Critical unknown subpacket is okay in unhashed area."); expectSignatureValidationSucceeds(key, "Critical unknown subpacket is okay in unhashed area.");
} }
@Test @ParameterizedTest
public void subkeyBindingUnknownNotationHashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingUnknownNotationHashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -767,8 +805,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown notation is okay in subkey binding sig."); expectSignatureValidationSucceeds(key, "Unknown notation is okay in subkey binding sig.");
} }
@Test @ParameterizedTest
public void subkeyBindingCriticalUnknownNotationHashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingCriticalUnknownNotationHashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -827,8 +868,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationFails(key, "Critical unknown notation invalidates subkey binding sig."); expectSignatureValidationFails(key, "Critical unknown notation invalidates subkey binding sig.");
} }
@Test @ParameterizedTest
public void subkeyBindingUnknownNotationUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingUnknownNotationUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -887,8 +931,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown notation is okay in unhashed area."); expectSignatureValidationSucceeds(key, "Unknown notation is okay in unhashed area.");
} }
@Test @ParameterizedTest
public void subkeyBindingCriticalUnknownNotationUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingCriticalUnknownNotationUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -947,8 +994,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Critical unknown notation is okay in unhashed area."); expectSignatureValidationSucceeds(key, "Critical unknown notation is okay in unhashed area.");
} }
@Test @ParameterizedTest
public void subkeyBindingBackSigFakeBackSig() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingBackSigFakeBackSig(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1017,8 +1067,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Back-sig, fake back-sig should succeed to verify"); expectSignatureValidationSucceeds(key, "Back-sig, fake back-sig should succeed to verify");
} }
@Test @ParameterizedTest
public void subkeyBindingFakeBackSigBackSig() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void subkeyBindingFakeBackSigBackSig(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1087,8 +1140,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Fake back-sig, back-sig should succeed to verify."); expectSignatureValidationSucceeds(key, "Fake back-sig, back-sig should succeed to verify.");
} }
@Test @ParameterizedTest
public void primaryBindingIssuerFpOnly() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingIssuerFpOnly(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1146,8 +1202,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "issuer fp is enough"); expectSignatureValidationSucceeds(key, "issuer fp is enough");
} }
@Test @ParameterizedTest
public void primaryBindingIssuerV6IssuerFp() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingIssuerV6IssuerFp(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1205,8 +1264,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "interop"); expectSignatureValidationSucceeds(key, "interop");
} }
@Test @ParameterizedTest
public void primaryBindingIssuerFakeIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingIssuerFakeIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1264,8 +1326,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "interop"); expectSignatureValidationSucceeds(key, "interop");
} }
@Test @ParameterizedTest
public void primaryBindingFakeIssuerIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingFakeIssuerIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1323,8 +1388,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "interop"); expectSignatureValidationSucceeds(key, "interop");
} }
@Test @ParameterizedTest
public void primaryBindingFakeIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingFakeIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1382,8 +1450,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Fake issuer on primary key binding sig is not an issue."); expectSignatureValidationSucceeds(key, "Fake issuer on primary key binding sig is not an issue.");
} }
@Test @ParameterizedTest
public void primaryBindingNoIssuer() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingNoIssuer(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1440,8 +1511,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Missing issuer on primary key binding sig is not an issue"); expectSignatureValidationSucceeds(key, "Missing issuer on primary key binding sig is not an issue");
} }
@Test @ParameterizedTest
public void primaryBindingUnknownSubpacketHashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingUnknownSubpacketHashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1499,8 +1573,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown subpacket in hashed area is not a problem."); expectSignatureValidationSucceeds(key, "Unknown subpacket in hashed area is not a problem.");
} }
@Test @ParameterizedTest
public void primaryBindingCriticalUnknownSubpacketHashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingCriticalUnknownSubpacketHashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1558,8 +1635,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationFails(key, "Critical unknown subpacket in hashed area invalidates signature."); expectSignatureValidationFails(key, "Critical unknown subpacket in hashed area invalidates signature.");
} }
@Test @ParameterizedTest
public void primaryBindingUnknownSubpacketUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingUnknownSubpacketUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1617,8 +1697,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown subpacket is not an issue in the unhashed area"); expectSignatureValidationSucceeds(key, "Unknown subpacket is not an issue in the unhashed area");
} }
@Test @ParameterizedTest
public void primaryBindingCriticalUnknownSubpacketUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingCriticalUnknownSubpacketUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1676,8 +1759,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Critical unknown subpacket is acceptable in unhashed area of primary binding sig"); expectSignatureValidationSucceeds(key, "Critical unknown subpacket is acceptable in unhashed area of primary binding sig");
} }
@Test @ParameterizedTest
public void primaryBindingUnknownNotationHashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingUnknownNotationHashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1736,8 +1822,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown notation is acceptable in hashed area of primary binding sig."); expectSignatureValidationSucceeds(key, "Unknown notation is acceptable in hashed area of primary binding sig.");
} }
@Test @ParameterizedTest
public void primaryBindingCriticalUnknownNotationHashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingCriticalUnknownNotationHashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1796,8 +1885,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationFails(key, "Critical unknown notation in hashed area invalidates primary binding sig"); expectSignatureValidationFails(key, "Critical unknown notation in hashed area invalidates primary binding sig");
} }
@Test @ParameterizedTest
public void primaryBindingUnknownNotationUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingUnknownNotationUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +
@ -1856,8 +1948,11 @@ public class BindingSignatureSubpacketsTest {
expectSignatureValidationSucceeds(key, "Unknown notation in unhashed area of primary key binding is okay."); expectSignatureValidationSucceeds(key, "Unknown notation in unhashed area of primary key binding is okay.");
} }
@Test @ParameterizedTest
public void primaryBindingCriticalUnknownNotationUnhashed() throws IOException, PGPException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void primaryBindingCriticalUnknownNotationUnhashed(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + String key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
"\n" + "\n" +
"xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" + "xsDNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv\n" +