Package org.apache.camel.util.jsse

Examples of org.apache.camel.util.jsse.KeyStoreParameters


    /*
     * 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);
View Full Code Here


        xmlsecTestHelper.testEncryption(context);
    }
   
    @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);
View Full Code Here

        xmlsecTestHelper.testEncryption(context);
    }
   
    @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);
View Full Code Here

     * 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")
View Full Code Here

    }
   
    @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,
View Full Code Here

    }
   
    @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")
View Full Code Here

        scp.createSSLContext();
    }
   
    @Test
    public void testKeyStoreParametersResourceLoading() throws Exception {
        KeyStoreParameters ksp = new KeyStoreParameters();
        ksp.setPassword("changeit");
        ksp.setResource("org/apache/camel/itest/osgi/util/jsse/localhost.ks");

        KeyStore ks = ksp.createKeyStore();
        assertNotNull(ks.getCertificate("server"));

        URL resourceUrl = this.getClass().getResource("/org/apache/camel/itest/osgi/util/jsse/localhost.ks");
        ksp.setResource(resourceUrl.toExternalForm());
        ks = ksp.createKeyStore();
        assertNotNull(ks.getCertificate("server"));

        File file = new File("../../../test-classes/org/apache/camel/itest/osgi/util/jsse/localhost.ks");
        LOG.info("the file is " + file.getAbsolutePath());
        ksp.setResource(file.getAbsolutePath());
        ks = ksp.createKeyStore();
        assertNotNull(ks.getCertificate("server"));
    }
View Full Code Here

public class SecurityAsymRouteBuilder extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        final boolean secureTagContents = true;

        final KeyStoreParameters trustStoreParameters = new KeyStoreParameters();
        trustStoreParameters.setResource("xml_truststore.jks");
        trustStoreParameters.setPassword("truststorePassword");

        final KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
        keyStoreParameters.setResource("xml_keystore.jks");
        keyStoreParameters.setPassword("keystorePassword");

        from("direct:encrypt").id("encrypt")
            .marshal()
                .secureXML(
                    "/booksignings/store/address", // secure tag
View Full Code Here

public class SecurityAsymNamespacesRouteBuilder extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        final boolean secureTagContents = true;

        final KeyStoreParameters trustStoreParameters = new KeyStoreParameters();
        trustStoreParameters.setResource("xml_truststore.jks");
        trustStoreParameters.setPassword("truststorePassword");

        final KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
        keyStoreParameters.setResource("xml_keystore.jks");
        keyStoreParameters.setPassword("keystorePassword");

        final Map<String, String> namespaces = new HashMap<String, String>();
        namespaces.put("c", "http://camelcookbook.org/schema/booksignings");

        from("direct:encrypt").id("encrypt")
View Full Code Here

    }

    @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() {
View Full Code Here

TOP

Related Classes of org.apache.camel.util.jsse.KeyStoreParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.