use of nl.nn.adapterframework.pgp.Decrypt in project iaf by ibissource.
the class PGPPipe method configure.
@Override
public void configure() throws ConfigurationException {
super.configure();
if (action == null)
throw new ConfigurationException("Action can not be null!");
if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) != null)
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
Security.addProvider(new BouncyCastleProvider());
switch(action.toLowerCase()) {
case "encrypt":
pgpAction = new Encrypt(publicKeys, recipients);
break;
case "decrypt":
pgpAction = new Decrypt(secretKey, secretPassword);
break;
case "sign":
if (verificationAddresses == null || verificationAddresses.length == 0)
throw new ConfigurationException("During signing action, senders has to be set.");
pgpAction = new Sign(publicKeys, secretKey, secretPassword, recipients, verificationAddresses[0]);
break;
case "verify":
pgpAction = new Verify(publicKeys, secretKey, secretPassword, verificationAddresses);
break;
default:
throw new ConfigurationException("Unknown action. Action has to be set to one of [Encrypt, Decrypt, Sign, Verify]");
}
pgpAction.configure();
}
Aggregations