web services - Having Separate Certificates Running Under GlassFish 2 -
can please explain how can have more 1 x.509 certificates in glassfish application server? main challenge me glassfish uses 1 alias 's1as'.
you can pull additional certificates external key files create sslcontext
, sslsocketfactory
, can feed external https calls.
e.g.:
keystore ckeystore = keystore.getinstance("pkcs12"); try (inputstream clientcertkeyinput = new fileinputstream("my.pfx")) { ckeystore.load(clientcertkeyinput, "password".tochararray()); } keymanagerfactory keymanagerfactory = keymanagerfactory.getinstance(keymanagerfactory.getdefaultalgorithm()); keymanagerfactory.init(ckeystore, "password".tochararray()); sslcontext sslctx = sslcontext.getinstance("tls"); sslctx.init(keymanagerfactory.getkeymanagers(), null, // default javax.net.ssl.truststore new securerandom()); sslsocketfactory sslsocketfactory = sslctx.getsocketfactory();
you may configure httpsurlconnection
it:
httpsconn.setsslsocketfactory(sslsocketfactory);
or if you're using jaxws set property of bindingprovider
's context:
map<string, object> ctxt = ((bindingprovider) port).getrequestcontext(); ctxt.put(jaxwsproperties.ssl_socket_factory, sslsocketfactory);
hope helps.
Comments
Post a Comment