Search in sources :

Example 26 with KeyManagersParameters

use of org.apache.camel.util.jsse.KeyManagersParameters in project camel by apache.

the class ApnsUtils method clientContext.

public static SSLContextParameters clientContext() throws Exception {
    final KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(ClassLoader.getSystemResource(FixedCertificates.CLIENT_STORE).toString());
    ksp.setType("PKCS12");
    final KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyStore(ksp);
    kmp.setKeyPassword(FixedCertificates.CLIENT_PASSWORD);
    kmp.setAlgorithm(getAlgorithm());
    final SSLContextParameters contextParameters = new SSLContextParameters();
    contextParameters.setKeyManagers(kmp);
    contextParameters.setTrustManagers(new TrustManagersParameters() {

        @Override
        public TrustManager[] createTrustManagers() throws GeneralSecurityException, IOException {
            return new TrustManager[] { new X509TrustManager() {

                public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                }

                public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                }

                public X509Certificate[] getAcceptedIssuers() {
                    return new X509Certificate[0];
                }
            } };
        }
    });
    return contextParameters;
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) X509TrustManager(javax.net.ssl.X509TrustManager) GeneralSecurityException(java.security.GeneralSecurityException) TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) CertificateException(java.security.cert.CertificateException) IOException(java.io.IOException) X509Certificate(java.security.cert.X509Certificate) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Aggregations

KeyManagersParameters (org.apache.camel.util.jsse.KeyManagersParameters)26 KeyStoreParameters (org.apache.camel.util.jsse.KeyStoreParameters)25 SSLContextParameters (org.apache.camel.util.jsse.SSLContextParameters)24 TrustManagersParameters (org.apache.camel.util.jsse.TrustManagersParameters)17 JndiRegistry (org.apache.camel.impl.JndiRegistry)11 SSLContextServerParameters (org.apache.camel.util.jsse.SSLContextServerParameters)7 RouteBuilder (org.apache.camel.builder.RouteBuilder)3 Exchange (org.apache.camel.Exchange)2 Processor (org.apache.camel.Processor)2 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1 CertificateException (java.security.cert.CertificateException)1 X509Certificate (java.security.cert.X509Certificate)1 X509TrustManager (javax.net.ssl.X509TrustManager)1 CipherSuitesParameters (org.apache.camel.util.jsse.CipherSuitesParameters)1 SecureSocketProtocolsParameters (org.apache.camel.util.jsse.SecureSocketProtocolsParameters)1