use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class XMLEncryption11Test method testFullPayloadAsymmetricKeyDecryptionSHA256.
@Test
public void testFullPayloadAsymmetricKeyDecryptionSHA256() throws Exception {
final KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
final KeyStoreParameters ksParameters = new KeyStoreParameters();
ksParameters.setPassword("password");
ksParameters.setResource("recipient.ks");
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal().secureXML("", new HashMap<String, String>(), true, "recipient", XMLCipher.AES_128, XMLCipher.RSA_OAEP, tsParameters, null, XMLCipher.SHA256).to("mock:encrypted").unmarshal().secureXML("", new HashMap<String, String>(), true, "recipient", XMLCipher.AES_128, XMLCipher.RSA_OAEP, ksParameters, null, XMLCipher.SHA256).to("mock:decrypted");
}
});
xmlsecTestHelper.testDecryption(context);
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class XMLEncryption11Test method testFullPayloadAsymmetricKeyDecryptionGCM.
/*
* Decryption Tests
*/
@Test
public void testFullPayloadAsymmetricKeyDecryptionGCM() throws Exception {
final KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
final KeyStoreParameters ksParameters = new KeyStoreParameters();
ksParameters.setPassword("password");
ksParameters.setResource("recipient.ks");
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal().secureXML("", true, "recipient", XMLCipher.AES_128_GCM, XMLCipher.RSA_OAEP, tsParameters).to("mock:encrypted").unmarshal().secureXML("", true, "recipient", XMLCipher.AES_128_GCM, XMLCipher.RSA_OAEP, ksParameters).to("mock:decrypted");
}
});
xmlsecTestHelper.testDecryption(context);
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class XMLEncryption11Test method testFullPayloadAsymmetricKeyEncryptionGCM.
/*
* Encryption Tests
*/
@Test
public void testFullPayloadAsymmetricKeyEncryptionGCM() throws Exception {
KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
final XMLSecurityDataFormat xmlEncDataFormat = new XMLSecurityDataFormat();
xmlEncDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_OAEP);
xmlEncDataFormat.setKeyOrTrustStoreParameters(tsParameters);
xmlEncDataFormat.setXmlCipherAlgorithm(XMLCipher.AES_128_GCM);
xmlEncDataFormat.setRecipientKeyAlias("recipient");
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal(xmlEncDataFormat).to("mock:encrypted");
}
});
xmlsecTestHelper.testEncryption(context);
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class XMLEncryption11Test method testFullPayloadAsymmetricKeyEncryptionSHA256.
@Test
public void testFullPayloadAsymmetricKeyEncryptionSHA256() throws Exception {
KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
final XMLSecurityDataFormat xmlEncDataFormat = new XMLSecurityDataFormat();
xmlEncDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_OAEP);
xmlEncDataFormat.setKeyOrTrustStoreParameters(tsParameters);
xmlEncDataFormat.setXmlCipherAlgorithm(XMLCipher.AES_128);
xmlEncDataFormat.setRecipientKeyAlias("recipient");
xmlEncDataFormat.setDigestAlgorithm(XMLCipher.SHA256);
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal(xmlEncDataFormat).to("mock:encrypted");
}
});
xmlsecTestHelper.testEncryption(context);
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class RestletHttpsWithSSLContextParametersTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").getPath().toString());
ksp.setPassword("changeit");
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword("changeit");
kmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
JndiRegistry registry = super.createRegistry();
registry.bind("mySSLContextParameters", sslContextParameters);
return registry;
}
Aggregations