use of org.apache.camel.util.jsse.KeyStoreParameters 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;
}
use of org.apache.camel.util.jsse.KeyStoreParameters in project camel by apache.
the class SignatureTests method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
KeyStore keystore = loadKeystore();
Certificate cert = keystore.getCertificate("bob");
KeyStoreParameters keystoreParameters = new KeyStoreParameters();
keystoreParameters.setPassword("letmein");
keystoreParameters.setResource("./ks.keystore");
registry.bind("signatureParams", keystoreParameters);
registry.bind("keystore", keystore);
registry.bind("myPublicKey", cert.getPublicKey());
registry.bind("myCert", cert);
registry.bind("myPrivateKey", keystore.getKey("bob", "letmein".toCharArray()));
return registry;
}
Aggregations