use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class EncryptionAlgorithmTest method testRSAOAEP11KW.
@Test
public void testRSAOAEP11KW() throws Exception {
final XMLSecurityDataFormat sendingDataFormat = new XMLSecurityDataFormat();
sendingDataFormat.setSecureTagContents(true);
sendingDataFormat.setSecureTag("//cheesesites/italy/cheese");
sendingDataFormat.setXmlCipherAlgorithm(XMLCipher.AES_128);
sendingDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_OAEP_11);
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_OAEP_11);
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 EncryptionAlgorithmTest method testRSAOAEPKW.
@Test
public void testRSAOAEPKW() throws Exception {
final XMLSecurityDataFormat sendingDataFormat = new XMLSecurityDataFormat();
sendingDataFormat.setSecureTagContents(true);
sendingDataFormat.setSecureTag("//cheesesites/italy/cheese");
sendingDataFormat.setXmlCipherAlgorithm(XMLCipher.AES_128);
sendingDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_OAEP);
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_OAEP);
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 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);
}
Aggregations