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:
parent
8313895f26
commit
95121e2a55
7 changed files with 34 additions and 156 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue