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

Get rid of redundant SecretKeyRingProtector implementations.

This commit is contained in:
Paul Schaub 2021-05-14 18:37:47 +02:00
parent 8313895f26
commit 95121e2a55
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
7 changed files with 34 additions and 156 deletions

View file

@ -126,22 +126,4 @@ public class SecretKeyRingProtectorTest {
assertEquals(Passphrase.emptyPassphrase(), protector.getPassphraseFor(1L));
assertEquals(Passphrase.fromPassword("missingP455w0rd"), protector.getPassphraseFor(3L));
}
@ParameterizedTest
@MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories")
public void testCallbackBasedKeyRingProtector(ImplementationFactory implementationFactory) throws IOException, PGPException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
SecretKeyRingProtector2 protector = new CallbackBasedKeyringProtector(new CallbackBasedKeyringProtector.Callback() {
@Override
public Passphrase getPassphraseFor(PGPSecretKey secretKey) {
return TestKeys.CRYPTIE_PASSPHRASE;
}
});
PGPSecretKeyRing secretKeys = TestKeys.getEmilSecretKeyRing();
for (PGPSecretKey secretKey : secretKeys) {
UnlockSecretKey.unlockSecretKey(secretKey, protector);
assertNotNull(protector.getEncryptor(secretKey));
}
}
}