use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class LumberjackComponentSSLTest method createServerSSLContextParameters.
/**
* Creates the {@link SSLContextParameters} Camel object for the Lumberjack component
*
* @return The {@link SSLContextParameters} Camel object for the Lumberjack component
*/
private SSLContextParameters createServerSSLContextParameters() {
SSLContextParameters sslContextParameters = new SSLContextParameters();
KeyManagersParameters keyManagersParameters = new KeyManagersParameters();
KeyStoreParameters keyStore = new KeyStoreParameters();
keyStore.setPassword("changeit");
keyStore.setResource("org/apache/camel/component/lumberjack/keystore.jks");
keyManagersParameters.setKeyPassword("changeit");
keyManagersParameters.setKeyStore(keyStore);
sslContextParameters.setKeyManagers(keyManagersParameters);
return sslContextParameters;
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class XMLSecurityDataFormatTest method testFullPayloadAsymmetricKeyDecryptionWithKeyPassword.
@Test
public void testFullPayloadAsymmetricKeyDecryptionWithKeyPassword() 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-with-key-pass.ks");
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal().secureXML("", true, "recipient", testCypherAlgorithm, XMLCipher.RSA_v1dot5, tsParameters).to("mock:encrypted").unmarshal().secureXML("", true, "recipient", testCypherAlgorithm, XMLCipher.RSA_v1dot5, ksParameters, "keyPassword").to("mock:decrypted");
}
});
xmlsecTestHelper.testDecryption(context);
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class EncryptionAlgorithmTest method testRSAv15KW.
@Test
public void testRSAv15KW() throws Exception {
final XMLSecurityDataFormat sendingDataFormat = new XMLSecurityDataFormat();
sendingDataFormat.setSecureTagContents(true);
sendingDataFormat.setSecureTag("//cheesesites/italy/cheese");
sendingDataFormat.setXmlCipherAlgorithm(XMLCipher.AES_128);
sendingDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_v1dot5);
sendingDataFormat.setRecipientKeyAlias("recipient");
KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
sendingDataFormat.setKeyOrTrustStoreParameters(tsParameters);
final XMLSecurityDataFormat receivingDataFormat = new XMLSecurityDataFormat();
receivingDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_v1dot5);
receivingDataFormat.setRecipientKeyAlias("recipient");
receivingDataFormat.setSecureTag("//cheesesites/italy/cheese");
KeyStoreParameters ksParameters = new KeyStoreParameters();
ksParameters.setPassword("password");
ksParameters.setResource("recipient.ks");
receivingDataFormat.setKeyOrTrustStoreParameters(ksParameters);
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal(sendingDataFormat).to("mock:encrypted").log("Body: + ${body}").unmarshal(receivingDataFormat).to("mock:decrypted");
}
});
xmlsecTestHelper.testDecryption(context);
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class XMLEncryption11Test method testFullPayloadAsymmetricKeyEncryptionMGF256.
@Test
public void testFullPayloadAsymmetricKeyEncryptionMGF256() throws Exception {
KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
final XMLSecurityDataFormat xmlEncDataFormat = new XMLSecurityDataFormat();
xmlEncDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_OAEP_11);
xmlEncDataFormat.setKeyOrTrustStoreParameters(tsParameters);
xmlEncDataFormat.setXmlCipherAlgorithm(XMLCipher.AES_128);
xmlEncDataFormat.setMgfAlgorithm(EncryptionConstants.MGF1_SHA256);
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 XMLSecurityDataFormatTest method testFullPayloadAsymmetricKeyEncryption.
@Test
public void testFullPayloadAsymmetricKeyEncryption() throws Exception {
KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
final XMLSecurityDataFormat xmlEncDataFormat = new XMLSecurityDataFormat();
xmlEncDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_v1dot5);
xmlEncDataFormat.setKeyOrTrustStoreParameters(tsParameters);
xmlEncDataFormat.setXmlCipherAlgorithm(testCypherAlgorithm);
xmlEncDataFormat.setRecipientKeyAlias("recipient");
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal(xmlEncDataFormat).to("mock:encrypted");
}
});
xmlsecTestHelper.testEncryption(context);
}
Aggregations