In practice, however, it is often difficult to create KeyManagers or
TrustManagers, the class also is the utility which can make this easier. It
can make KeyManagers and TrustManagers transparently if user would like to
use system properties setting or string parameters:

Example 1: To get SSLSocketFactory
getSSLSocketFactoryFromSysProperties() from setting system
parameters

String clientKeyStore = ...;
String clientKeyStorePasswd = ...;
String trustKeystore = ...;
String trustKeystorePasswd = ...;
System.setProperty(&quot;javax.net.ssl.keyStore&quot;, clientKeyStore);
System.setProperty(&quot;javax.net.ssl.keyStorePassword&quot;, clientKeyStorePasswd);
System.setProperty(&quot;javax.net.ssl.trustStore&quot;, trustKeystore);
System.setProperty(&quot;javax.net.ssl.trustStorePasswd&quot;, trustKeystorePasswd);
//user can print out the sslInfo for debug
System.out.print(sslInfo.toString());
((BindingProvider) port).getRequestContext().put(
JAXWSProperties.SSL_SOCKET_FACTORY,
SSLClientUtil.getSSLSocketFactoryFromSysProperties());
NOTE: The clientKeyStore and clientKeyStorePasswd have this restriction:
The SSL package of J2SE requires that the password of the client’s
private key must be the same as the password of the client’s keystore. For
this reason, the client keystore can include only one private key and X.509
certificate pair.