use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class XMLEncryption11Test method testFullPayloadAsymmetricKeyDecryptionMGF256.
@Test
public void testFullPayloadAsymmetricKeyDecryptionMGF256() throws Exception {
final 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");
final KeyStoreParameters ksParameters = new KeyStoreParameters();
ksParameters.setPassword("password");
ksParameters.setResource("recipient.ks");
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal(xmlEncDataFormat).to("mock:encrypted").unmarshal().secureXML("", new HashMap<String, String>(), true, "recipient", XMLCipher.AES_128, XMLCipher.RSA_OAEP, ksParameters).to("mock:decrypted");
}
});
xmlsecTestHelper.testDecryption(context);
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class XMLSecurityDataFormatTest method testPartialPayloadAsymmetricKeyEncryptionWithContextTruststoreProperties.
@SuppressWarnings("deprecation")
@Test
public void testPartialPayloadAsymmetricKeyEncryptionWithContextTruststoreProperties() throws Exception {
final KeyStoreParameters tsParameters = new KeyStoreParameters();
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
Map<String, String> contextProps = context.getProperties();
contextProps.put(XMLSecurityDataFormat.XML_ENC_TRUST_STORE_PASSWORD, "password");
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal().secureXML("//cheesesites/italy/cheese", true, "recipient", testCypherAlgorithm, XMLCipher.RSA_v1dot5, tsParameters).to("mock:encrypted");
}
});
xmlsecTestHelper.testEncryption(context);
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class XMLSecurityDataFormatTest method testPartialPayloadXMLContentDecryption.
@Test
public void testPartialPayloadXMLContentDecryption() throws Exception {
if (!TestHelper.HAS_3DES) {
return;
}
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal().secureXML("//cheesesites/italy/cheese", true).to("mock:encrypted").unmarshal().secureXML("//cheesesites/italy/cheese", true).to("mock:decrypted");
}
});
xmlsecTestHelper.testDecryption(context);
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class XMLSecurityDataFormatTest method testPartialPayloadXMLContentDecryptionWithKeyAndAlgorithm.
@Test
public void testPartialPayloadXMLContentDecryptionWithKeyAndAlgorithm() throws Exception {
final byte[] bits128 = { (byte) 0x08, (byte) 0x09, (byte) 0x0A, (byte) 0x0B, (byte) 0x0C, (byte) 0x0D, (byte) 0x0E, (byte) 0x0F, (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13, (byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17 };
final String passCode = new String(bits128);
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal().secureXML("//cheesesites/italy", true, passCode, XMLCipher.AES_128).to("mock:encrypted").unmarshal().secureXML("//cheesesites/italy", true, passCode, XMLCipher.AES_128).to("mock:decrypted");
}
});
xmlsecTestHelper.testDecryption(context);
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class XMLSecurityDataFormatTest method testPartialPayloadXMLContentEncryption.
@Test
public void testPartialPayloadXMLContentEncryption() throws Exception {
if (!TestHelper.HAS_3DES) {
return;
}
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").marshal().secureXML("//cheesesites/italy/cheese", true).to("mock:encrypted");
}
});
xmlsecTestHelper.testEncryption(context);
}
Aggregations