/** * * @return certificate paramters for tls * @throws GeneralSecurityException * @throws IOException */ public static SSLContextParameters sslParameters() throws GeneralSecurityException, IOException { String storePath = System.getProperty(ServerProperties.KEYSTORE); String alias = System.getProperty(ServerProperties.ALIAS); String pass = System.getProperty(ServerProperties.PASS); KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(storePath); ksp.setPassword(pass); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyStore(ksp); kmp.setKeyPassword(pass); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters scp = new SSLContextParameters(); scp.setKeyManagers(kmp); scp.setTrustManagers(tmp); return scp; }
private SSLContextParameters createProducerSSLContextParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(KEYSTORE_PATH); ksp.setPassword(KEYSTORE_PASSWORD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyStore(ksp); kmp.setKeyPassword(KEYSTORE_PASSWORD); SSLContextClientParameters sslContextClientParameters = new SSLContextClientParameters(); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setClientParameters(sslContextClientParameters); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setCertAlias(TRUSTSTORE_ALIAS_NAME); // so that the client trusts the self-signed server certificate TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); sslContextParameters.setTrustManagers(tmp); return sslContextParameters; }
private SSLContextParameters createConsumerSSLContextParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(KEYSTORE_PATH); ksp.setPassword(KEYSTORE_PASSWORD); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextServerParameters sslContextServerParameters = new SSLContextServerParameters(); sslContextServerParameters.setClientAuthentication(ClientAuthentication.REQUIRE.name()); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setServerParameters(sslContextServerParameters); sslContextParameters.setTrustManagers(tmp); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyStore(ksp); kmp.setKeyPassword(KEYSTORE_PASSWORD); sslContextParameters.setKeyManagers(kmp); return sslContextParameters; }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("server.jks"); ksp.setPassword("password"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword("password"); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setSecureSocketProtocol("SSL"); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("server.jks"); ksp.setPassword("password"); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setSecureSocketProtocol("SSL"); sslContextParameters.setTrustManagers(tmp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("server.jks"); ksp.setPassword("password"); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setSecureSocketProtocol("TLS"); sslContextParameters.setTrustManagers(tmp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("server.jks"); ksp.setPassword("password"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword("password"); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setSecureSocketProtocol("TLS"); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
protected TrustManagersParameters createInstance() throws Exception { TrustManagersParameters newInstance = new TrustManagersParameters(); newInstance.setAlgorithm(algorithm); if (getKeyStore() != null) { getKeyStore().setCamelContext(getCamelContext()); newInstance.setKeyStore(getKeyStore().getObject()); } newInstance.setProvider(provider); newInstance.setCamelContext(getCamelContext()); if (trustManager != null) { TrustManager tm = CamelContextHelper.mandatoryLookup(getCamelContext(), trustManager, TrustManager.class); newInstance.setTrustManager(tm); } return newInstance; }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("localhost.ks"); ksp.setPassword("changeit"); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setTrustManagers(tmp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("jsse/localhost.ks"); ksp.setPassword(pwd); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(pwd); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); // NOTE: Needed since the client uses a loose trust configuration when no ssl context // is provided. We turn on WANT client-auth to prefer using authentication SSLContextServerParameters scsp = new SSLContextServerParameters(); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
protected SSLContextParameters defineSSLContextParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); // ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString()); ksp.setResource("jsse/localhost.ks"); ksp.setPassword(pwd); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(pwd); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); // NOTE: Needed since the client uses a loose trust configuration when no ssl context // is provided. We turn on WANT client-auth to prefer using authentication SSLContextServerParameters scsp = new SSLContextServerParameters(); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); return sslContextParameters; }
private static SSLContextParameters defineSSLContextServerParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("jsse/localhost.ks"); ksp.setPassword(PW); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(PW); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); // NOTE: Needed since the client uses a loose trust configuration when no ssl context // is provided. We turn on WANT client-auth to prefer using authentication SSLContextServerParameters scsp = new SSLContextServerParameters(); scsp.setClientAuthentication(ClientAuthentication.WANT.name()); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); return sslContextParameters; }
public static SSLContextParameters createSslContextParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(MailTestHelper.class.getClassLoader().getResource("jsse/localhost.ks").toString()); ksp.setPassword(KEY_STORE_PASSWORD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(KEY_STORE_PASSWORD); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); return sslContextParameters; }
private SSLContextParameters getSSLContextParameters(String path, String password) { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(path); ksp.setPassword(password); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(password); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); return sslContextParameters; }
protected void addSslContextParametersToRegistry(JndiRegistry registry) { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString()); ksp.setPassword(KEY_STORE_PASSWORD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(KEY_STORE_PASSWORD); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); // NOTE: Needed since the client uses a loose trust configuration when no ssl context // is provided. We turn on WANT client-auth to prefer using authentication SSLContextServerParameters scsp = new SSLContextServerParameters(); scsp.setClientAuthentication(ClientAuthentication.WANT.name()); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); registry.bind("sslContextParameters", sslContextParameters); }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("jsse/localhost.ks"); ksp.setPassword("changeit"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword("changeit"); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("./cia_keystore.jks"); ksp.setPassword("supersecret"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword("secret"); kmp.setKeyStore(ksp); KeyStoreParameters tsp = new KeyStoreParameters(); tsp.setResource("./cia_truststore.jks"); tsp.setPassword("supersecret"); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(tsp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); JndiRegistry registry = super.createRegistry(); registry.bind("ssl", sslContextParameters); return registry; }
private SSLContextParameters createSSLContextParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("./cia_keystore.jks"); ksp.setPassword("supersecret"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword("secret"); kmp.setKeyStore(ksp); KeyStoreParameters tsp = new KeyStoreParameters(); tsp.setResource("./cia_truststore.jks"); tsp.setPassword("supersecret"); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(tsp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); return sslContextParameters; }
private static SSLContextParameters defineSSLContextClientParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("/" + KEYSTORE); ksp.setPassword(KEYSTORE_PASSWORD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(KEYSTORE_PASSWORD); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters scp = new SSLContextParameters(); scp.setKeyManagers(kmp); scp.setTrustManagers(tmp); return scp; }
@Before public void setUp() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("/" + KEYSTORE); ksp.setPassword(KEYSTORE_PASSWORD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(KEYSTORE_PASSWORD); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters scp = new SSLContextParameters(); scp.setKeyManagers(kmp); scp.setTrustManagers(tmp); InitialContext context = new InitialContext(); context.bind("sslContextParameters", scp); }
private SSLContextParameters createSSLContextParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(System.getProperty("jboss.server.config.dir") + "/application.keystore"); ksp.setPassword("password"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyStore(ksp); kmp.setKeyPassword("password"); SSLContextClientParameters sslContextClientParameters = new SSLContextClientParameters(); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setClientParameters(sslContextClientParameters); sslContextParameters.setKeyManagers(kmp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); sslContextParameters.setTrustManagers(tmp); return sslContextParameters; }
@Override public TrustManagersParameters getObject() throws Exception { if (isSingleton()) { if (instance == null) { instance = createInstance(); } return instance; } else { return createInstance(); } }
@Override protected JndiRegistry createRegistry() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(this.getClass().getClassLoader().getResource("keystore.jks").toString()); ksp.setPassword("changeit"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword("changeit"); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); // NOTE: Needed since the client uses a loose trust configuration when no ssl context // is provided. We turn on WANT client-auth to prefer using authentication SSLContextServerParameters scsp = new SSLContextServerParameters(); scsp.setClientAuthentication(ClientAuthentication.WANT.name()); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); JndiRegistry registry = super.createRegistry(); registry.bind("sslContextParameters", sslContextParameters); return registry; }
private static SSLContextParameters defineSSLContextClientParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("jsse/localhost.ks"); ksp.setPassword(PW); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setTrustManagers(tmp); return sslContextParameters; }
protected void addSslContextParametersToRegistry(JndiRegistry registry) { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString()); ksp.setPassword(KEY_STORE_PASSWORD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(KEY_STORE_PASSWORD); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); // NOTE: Needed since the client uses a loose trust configuration when no ssl context // is provided. We turn on WANT client-auth to prefer using authentication SSLContextServerParameters scsp = new SSLContextServerParameters(); scsp.setClientAuthentication(ClientAuthentication.WANT.name()); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); // use SSLv3 to avoid issue with (eg disable TLS) // Caused by: javax.net.ssl.SSLException: bad record MAC sslContextParameters.setSecureSocketProtocol("SSLv3"); registry.bind("sslContextParameters", sslContextParameters); }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("jsse/localhost.ks"); ksp.setPassword("changeit"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword("changeit"); kmp.setKeyStore(ksp); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); CometdComponent component = (CometdComponent) context.getComponent("cometds"); component.setSslContextParameters(sslContextParameters); from("direct:input").to(uri); from(uri).to("mock:test"); } }; }
public EmailTrust() { TrustManagersParameters trustManagers = new TrustManagersParameters(); trustManagers.setTrustManager(new DummyTrustManager()); setTrustManagers(trustManagers); }
@Override public Class<TrustManagersParameters> getObjectType() { return TrustManagersParameters.class; }