Updated Branches: refs/heads/master 1685f8f6c -> 5a0697421
CAMEL-6657: improve unit test of camel-crypto. Thanks to Colm for the patch. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5a069742 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5a069742 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5a069742 Branch: refs/heads/master Commit: 5a0697421efd930146953b1be0f98651b37c5698 Parents: 1685f8f Author: Claus Ibsen <[email protected]> Authored: Thu Aug 22 15:07:48 2013 +0200 Committer: Claus Ibsen <[email protected]> Committed: Thu Aug 22 15:07:48 2013 +0200 ---------------------------------------------------------------------- .../crypto/DigitalSignatureConfiguration.java | 2 +- .../component/crypto/ECDSASignatureTest.java | 139 +++++++++++++++++++ .../camel/component/crypto/SignatureTests.java | 44 +++++- .../converter/crypto/CryptoDataFormatTest.java | 115 ++++++++++++++- .../crypto/SpringCryptoDataFormatTest.java | 14 ++ .../crypto/SpringCryptoDataFormatTest.xml | 51 +++++++ .../component/crypto/SpringSignatureTests.xml | 18 +++ .../org/apache/camel/component/crypto/ecdsa.jks | Bin 0 -> 850 bytes 8 files changed, 377 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConfiguration.java b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConfiguration.java index c7ee58a..b7a1873 100644 --- a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConfiguration.java +++ b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConfiguration.java @@ -33,7 +33,7 @@ public class DigitalSignatureConfiguration implements Cloneable, CamelContextAwa private PrivateKey privateKey; private KeyStore keystore; private SecureRandom secureRandom; - private String algorithm = "DSA"; + private String algorithm = "SHA1WithDSA"; private Integer bufferSize = Integer.valueOf(2048); private String provider; private String signatureHeaderName; http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/ECDSASignatureTest.java ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/ECDSASignatureTest.java b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/ECDSASignatureTest.java new file mode 100644 index 0000000..85f5981 --- /dev/null +++ b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/ECDSASignatureTest.java @@ -0,0 +1,139 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.crypto; + +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.security.KeyStore; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.cert.X509Certificate; +import java.util.Collections; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Before; +import org.junit.Test; + +public class ECDSASignatureTest extends CamelTestSupport { + + private String payload = "Dear Alice, Rest assured it's me, signed Bob"; + private boolean ibmJDK; + + public ECDSASignatureTest() throws Exception { + // + // BouncyCastle is required for ECDSA support for JDK 1.6 + // + if (System.getProperty("java.version").startsWith("1.6") + && Security.getProvider("BC") == null) { + Constructor<?> cons = null; + Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); + cons = c.getConstructor(new Class[] {}); + + Provider provider = (java.security.Provider)cons.newInstance(); + Security.insertProviderAt(provider, 2); + } + + // + // This test fails with the IBM JDK + // + if ("IBM Corporation".equals(System.getProperty("java.vendor"))) { + ibmJDK = true; + } + } + + @Override + protected RouteBuilder[] createRouteBuilders() throws Exception { + if (ibmJDK) { + return new RouteBuilder[] {}; + } + + return new RouteBuilder[]{new RouteBuilder() { + public void configure() throws Exception { + // START SNIPPET: ecdsa-sha1 + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + InputStream in = ECDSASignatureTest.class.getResourceAsStream("/org/apache/camel/component/crypto/ecdsa.jks"); + keyStore.load(in, "security".toCharArray()); + PrivateKey privateKey = + (PrivateKey)keyStore.getKey("ECDSA", "security".toCharArray()); + X509Certificate x509 = (X509Certificate)keyStore.getCertificate("ECDSA"); + + // we can set the keys explicitly on the endpoint instances. + context.getEndpoint("crypto:sign://ecdsa-sha1?algorithm=SHA1withECDSA", DigitalSignatureEndpoint.class).setPrivateKey(privateKey); + context.getEndpoint("crypto:verify://ecdsa-sha1?algorithm=SHA1withECDSA", DigitalSignatureEndpoint.class).setPublicKey(x509.getPublicKey()); + from("direct:ecdsa-sha1").to("crypto:sign://ecdsa-sha1?algorithm=SHA1withECDSA", "crypto:verify://ecdsa-sha1?algorithm=SHA1withECDSA", "mock:result"); + // END SNIPPET: ecdsa-sha1 + } + }}; + } + + @Test + public void testECDSASHA1() throws Exception { + if (ibmJDK) { + return; + } + setupMock(); + sendBody("direct:ecdsa-sha1", payload); + assertMockEndpointsSatisfied(); + } + + private MockEndpoint setupMock() { + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedBodiesReceived(payload); + return mock; + } + + public Exchange doTestSignatureRoute(RouteBuilder builder) throws Exception { + return doSignatureRouteTest(builder, null, Collections.<String, Object>emptyMap()); + } + + public Exchange doSignatureRouteTest(RouteBuilder builder, Exchange e, Map<String, Object> headers) throws Exception { + CamelContext context = new DefaultCamelContext(); + try { + context.addRoutes(builder); + context.start(); + + MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class); + mock.setExpectedMessageCount(1); + + ProducerTemplate template = context.createProducerTemplate(); + if (e != null) { + template.send("direct:in", e); + } else { + template.sendBodyAndHeaders("direct:in", payload, headers); + } + assertMockEndpointsSatisfied(); + return mock.getReceivedExchanges().get(0); + } finally { + context.stop(); + } + } + + @Before + public void setUp() throws Exception { + disableJMX(); + super.setUp(); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java index 3240ba2..5751515 100644 --- a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java +++ b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java @@ -72,9 +72,7 @@ public class SignatureTests extends CamelTestSupport { }, new RouteBuilder() { public void configure() throws Exception { // START SNIPPET: algorithm - KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); - keyGen.initialize(512, new SecureRandom()); - keyPair = keyGen.generateKeyPair(); + keyPair = getKeyPair("RSA"); PrivateKey privateKey = keyPair.getPrivate(); PublicKey publicKey = keyPair.getPublic(); @@ -86,6 +84,32 @@ public class SignatureTests extends CamelTestSupport { } }, new RouteBuilder() { public void configure() throws Exception { + // START SNIPPET: rsa-sha1 + keyPair = getKeyPair("RSA"); + PrivateKey privateKey = keyPair.getPrivate(); + PublicKey publicKey = keyPair.getPublic(); + + // we can set the keys explicitly on the endpoint instances. + context.getEndpoint("crypto:sign://rsa?algorithm=SHA1withRSA", DigitalSignatureEndpoint.class).setPrivateKey(privateKey); + context.getEndpoint("crypto:verify://rsa?algorithm=SHA1withRSA", DigitalSignatureEndpoint.class).setPublicKey(publicKey); + from("direct:rsa-sha1").to("crypto:sign://rsa?algorithm=SHA1withRSA", "crypto:verify://rsa?algorithm=SHA1withRSA", "mock:result"); + // END SNIPPET: rsa-sha1 + } + }, new RouteBuilder() { + public void configure() throws Exception { + // START SNIPPET: rsa-sha256 + keyPair = getKeyPair("RSA"); + PrivateKey privateKey = keyPair.getPrivate(); + PublicKey publicKey = keyPair.getPublic(); + + // we can set the keys explicitly on the endpoint instances. + context.getEndpoint("crypto:sign://rsa?algorithm=SHA256withRSA", DigitalSignatureEndpoint.class).setPrivateKey(privateKey); + context.getEndpoint("crypto:verify://rsa?algorithm=SHA256withRSA", DigitalSignatureEndpoint.class).setPublicKey(publicKey); + from("direct:rsa-sha256").to("crypto:sign://rsa?algorithm=SHA256withRSA", "crypto:verify://rsa?algorithm=SHA256withRSA", "mock:result"); + // END SNIPPET: rsa-sha256 + } + }, new RouteBuilder() { + public void configure() throws Exception { // START SNIPPET: buffersize from("direct:buffersize").to("crypto:sign://buffer?privateKey=#myPrivateKey&buffersize=1024", "crypto:verify://buffer?publicKey=#myPublicKey&buffersize=1024", "mock:result"); // END SNIPPET: buffersize @@ -163,6 +187,20 @@ public class SignatureTests extends CamelTestSupport { sendBody("direct:algorithm", payload); assertMockEndpointsSatisfied(); } + + @Test + public void testRSASHA1() throws Exception { + setupMock(); + sendBody("direct:rsa-sha1", payload); + assertMockEndpointsSatisfied(); + } + + @Test + public void testRSASHA256() throws Exception { + setupMock(); + sendBody("direct:rsa-sha256", payload); + assertMockEndpointsSatisfied(); + } @Test public void testSetBufferInRouteDefinition() throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java index 9d0f5a9..180af28 100644 --- a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java +++ b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java @@ -18,10 +18,14 @@ package org.apache.camel.converter.crypto; import java.io.ByteArrayInputStream; import java.security.Key; +import java.security.SecureRandom; import java.util.Collections; import java.util.Map; + +import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; @@ -29,7 +33,6 @@ import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; - import org.junit.Test; public class CryptoDataFormatTest extends CamelTestSupport { @@ -58,7 +61,12 @@ public class CryptoDataFormatTest extends CamelTestSupport { public void testSymmetricWithMD5HMAC() throws Exception { doRoundTripEncryptionTests("direct:hmac-algorithm"); } - + + @Test + public void testSymmetricWithSHA256HMAC() throws Exception { + doRoundTripEncryptionTests("direct:hmac-sha-256-algorithm"); + } + @Test public void testKeySuppliedAsHeader() throws Exception { KeyGenerator generator = KeyGenerator.getInstance("DES"); @@ -81,6 +89,23 @@ public class CryptoDataFormatTest extends CamelTestSupport { Exchange received = mock.getReceivedExchanges().get(0); validateHeaderIsCleared(received); } + + @Test + public void test3DESECBSymmetric() throws Exception { + doRoundTripEncryptionTests("direct:3des-ecb-encryption"); + } + + @Test + public void test3DESCBCSymmetric() throws Exception { + doRoundTripEncryptionTests("direct:3des-cbc-encryption"); + } + + @Test + public void testAES128ECBSymmetric() throws Exception { + if (checkUnrestrictedPoliciesInstalled()) { + doRoundTripEncryptionTests("direct:aes-128-ecb-encryption"); + } + } private void validateHeaderIsCleared(Exchange ex) { Object header = ex.getIn().getHeader(CryptoDataFormat.KEY); @@ -199,6 +224,22 @@ public class CryptoDataFormatTest extends CamelTestSupport { } }, new RouteBuilder() { public void configure() throws Exception { + // START SNIPPET: hmac-sha256-algorithm + KeyGenerator generator = KeyGenerator.getInstance("DES"); + + CryptoDataFormat cryptoFormat = new CryptoDataFormat("DES", generator.generateKey()); + cryptoFormat.setShouldAppendHMAC(true); + cryptoFormat.setMacAlgorithm("HmacSHA256"); + + from("direct:hmac-sha-256-algorithm") + .marshal(cryptoFormat) + .to("mock:encrypted") + .unmarshal(cryptoFormat) + .to("mock:unencrypted"); + // END SNIPPET: hmac-sha256-algorithm + } + }, new RouteBuilder() { + public void configure() throws Exception { // START SNIPPET: key-in-header CryptoDataFormat cryptoFormat = new CryptoDataFormat("DES", null); /** @@ -221,6 +262,57 @@ public class CryptoDataFormatTest extends CamelTestSupport { }).to("mock:unencrypted"); // END SNIPPET: key-in-header } + }, new RouteBuilder() { + public void configure() throws Exception { + // START SNIPPET: 3DES-ECB + KeyGenerator generator = KeyGenerator.getInstance("DESede"); + + CryptoDataFormat cryptoFormat = new CryptoDataFormat("DESede/ECB/PKCS5Padding", generator.generateKey()); + + from("direct:3des-ecb-encryption") + .marshal(cryptoFormat) + .to("mock:encrypted") + .unmarshal(cryptoFormat) + .to("mock:unencrypted"); + // END SNIPPET: 3DES-ECB + } + }, new RouteBuilder() { + public void configure() throws Exception { + // START SNIPPET: 3DES-CBC + KeyGenerator generator = KeyGenerator.getInstance("DES"); + byte[] iv = new byte[8]; + SecureRandom random = new SecureRandom(); + random.nextBytes(iv); + Key key = generator.generateKey(); + + CryptoDataFormat encCryptoFormat = new CryptoDataFormat("DES/CBC/PKCS5Padding", key); + encCryptoFormat.setInitializationVector(iv); + encCryptoFormat.setShouldInlineInitializationVector(true); + + CryptoDataFormat decCryptoFormat = new CryptoDataFormat("DES/CBC/PKCS5Padding", key); + decCryptoFormat.setShouldInlineInitializationVector(true); + + from("direct:3des-cbc-encryption") + .marshal(encCryptoFormat) + .to("mock:encrypted") + .unmarshal(decCryptoFormat) + .to("mock:unencrypted"); + // END SNIPPET: 3DES-CBC + } + }, new RouteBuilder() { + public void configure() throws Exception { + // START SNIPPET: AES-128-ECB + KeyGenerator generator = KeyGenerator.getInstance("AES"); + + CryptoDataFormat cryptoFormat = new CryptoDataFormat("AES/ECB/PKCS5Padding", generator.generateKey()); + + from("direct:aes-128-ecb-encryption") + .marshal(cryptoFormat) + .to("mock:encrypted") + .unmarshal(cryptoFormat) + .to("mock:unencrypted"); + // END SNIPPET: AES-128-ECB + } }}; } @@ -233,5 +325,24 @@ public class CryptoDataFormatTest extends CamelTestSupport { mockEp.expectedMessageCount(expected); return mockEp; } + + public static boolean checkUnrestrictedPoliciesInstalled() { + try { + byte[] data = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; + + SecretKey key192 = new SecretKeySpec( + new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17}, + "AES"); + Cipher c = Cipher.getInstance("AES"); + c.init(Cipher.ENCRYPT_MODE, key192); + c.doFinal(data); + return true; + } catch (Exception e) { + // + } + return false; + } } http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java index 27467c7..f472690 100644 --- a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java +++ b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java @@ -27,6 +27,8 @@ import org.apache.camel.spring.SpringCamelContext; public class SpringCryptoDataFormatTest extends CryptoDataFormatTest { private static Key deskey; + private static Key desEdekey; + private static Key aeskey; @Override protected RouteBuilder[] createRouteBuilders() throws Exception { @@ -36,12 +38,24 @@ public class SpringCryptoDataFormatTest extends CryptoDataFormatTest { protected CamelContext createCamelContext() throws Exception { KeyGenerator generator = KeyGenerator.getInstance("DES"); deskey = generator.generateKey(); + generator = KeyGenerator.getInstance("DESede"); + desEdekey = generator.generateKey(); + generator = KeyGenerator.getInstance("AES"); + aeskey = generator.generateKey(); return SpringCamelContext.springCamelContext("/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml"); } public static Key getDesKey() { return deskey; } + + public static Key getDesEdeKey() { + return desEdekey; + } + + public static Key getAESKey() { + return aeskey; + } public static byte[] getIV() { return new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml b/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml index 0bba99f..b2ad9f4 100644 --- a/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml +++ b/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml @@ -44,9 +44,26 @@ <crypto id="hmac-algorithm" algorithm="DES" keyRef="desKey" macAlgorithm="HmacMD5" shouldAppendHMAC="true" /> <!-- END SNIPPET: hmac-algorithm --> + <!-- START SNIPPET: hmac-sha-256-algorithm --> + <crypto id="hmac-sha-256-algorithm" algorithm="DES" keyRef="desKey" macAlgorithm="HmacSHA256" shouldAppendHMAC="true" /> + <!-- END SNIPPET: hmac-sha-256-algorithm --> + <!-- START SNIPPET: header-key --> <crypto id="nokey" algorithm="DES" /> <!-- END SNIPPET: header-key --> + + <!-- START SNIPPET: tripledes-ecb-encryption --> + <crypto id="tripledes-ecb-encryption" algorithm="DESede/ECB/PKCS5Padding" keyRef="desEdeKey" /> + <!-- END SNIPPET: tripledes-ecb-encryption --> + + <!-- START SNIPPET: tripledes-cbc-encryption --> + <crypto id="tripledes-cbc-encryption-encrypt" algorithm="DESede/CBC/PKCS5Padding" keyRef="desEdeKey" initVectorRef="initializationVector" inline="true" /> + <crypto id="tripledes-cbc-encryption-decrypt" algorithm="DESede/CBC/PKCS5Padding" keyRef="desEdeKey" inline="true" /> + <!-- END SNIPPET: tripledes-cbc-encryption --> + + <!-- START SNIPPET: aes-128-ecb-encryption --> + <crypto id="aes-128-ecb-encryption" algorithm="AES/ECB/PKCS5Padding" keyRef="aesKey" /> + <!-- END SNIPPET: aes-128-ecb-encryption --> </dataFormats> <route> @@ -90,6 +107,14 @@ </route> <route> + <from uri="direct:hmac-sha-256-algorithm" /> + <marshal ref="hmac-sha-256-algorithm" /> + <to uri="mock:encrypted" /> + <unmarshal ref="hmac-sha-256-algorithm" /> + <to uri="mock:unencrypted" /> + </route> + + <route> <from uri="direct:key-in-header-encrypt" /> <marshal ref="nokey" /> <setHeader headerName="CamelCryptoKey"> @@ -107,9 +132,35 @@ <to uri="mock:unencrypted" /> </route> + <route> + <from uri="direct:3des-ecb-encryption" /> + <marshal ref="tripledes-ecb-encryption" /> + <to uri="mock:encrypted" /> + <unmarshal ref="tripledes-ecb-encryption" /> + <to uri="mock:unencrypted" /> + </route> + + <route> + <from uri="direct:3des-cbc-encryption" /> + <marshal ref="tripledes-cbc-encryption-encrypt" /> + <to uri="mock:encrypted" /> + <unmarshal ref="tripledes-cbc-encryption-decrypt" /> + <to uri="mock:unencrypted" /> + </route> + + <route> + <from uri="direct:aes-128-ecb-encryption" /> + <marshal ref="aes-128-ecb-encryption" /> + <to uri="mock:encrypted" /> + <unmarshal ref="aes-128-ecb-encryption" /> + <to uri="mock:unencrypted" /> + </route> + </camelContext> <bean id="desKey" class="org.apache.camel.converter.crypto.SpringCryptoDataFormatTest" factory-method="getDesKey" /> + <bean id="desEdeKey" class="org.apache.camel.converter.crypto.SpringCryptoDataFormatTest" factory-method="getDesEdeKey" /> + <bean id="aesKey" class="org.apache.camel.converter.crypto.SpringCryptoDataFormatTest" factory-method="getAESKey" /> <bean id="initializationVector" class="org.apache.camel.converter.crypto.SpringCryptoDataFormatTest" factory-method="getIV" /> </beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringSignatureTests.xml ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringSignatureTests.xml b/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringSignatureTests.xml index 9ee0579..04cef37 100644 --- a/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringSignatureTests.xml +++ b/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/SpringSignatureTests.xml @@ -41,6 +41,24 @@ </route> <!-- END SNIPPET: algorithm --> + <!-- START SNIPPET: rsa-sha1 --> + <route> + <from uri="direct:rsa-sha1"/> + <to uri="crypto:sign://rsa?algorithm=SHA1withRSA&privateKey=#rsaPrivateKey" /> + <to uri="crypto:verify://rsa?algorithm=SHA1withRSA&publicKey=#rsaPublicKey" /> + <to uri="mock:result"/> + </route> + <!-- END SNIPPET: rsa-sha1 --> + + <!-- START SNIPPET: rsa-sha256 --> + <route> + <from uri="direct:rsa-sha256"/> + <to uri="crypto:sign://rsa?algorithm=SHA256withRSA&privateKey=#rsaPrivateKey" /> + <to uri="crypto:verify://rsa?algorithm=SHA256withRSA&publicKey=#rsaPublicKey" /> + <to uri="mock:result"/> + </route> + <!-- END SNIPPET: rsa-sha256 --> + <!-- START SNIPPET: buffersize --> <route> <from uri="direct:buffersize" /> http://git-wip-us.apache.org/repos/asf/camel/blob/5a069742/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/ecdsa.jks ---------------------------------------------------------------------- diff --git a/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/ecdsa.jks b/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/ecdsa.jks new file mode 100644 index 0000000..699e0b7 Binary files /dev/null and b/components/camel-crypto/src/test/resources/org/apache/camel/component/crypto/ecdsa.jks differ
