Setup secured XML-RPC server

Although its old tech, but just getting an idea how to setup secured server.

 

Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider() );
KeyStore keystore = KeyStore.getInstance( KEYSTORE_TYPE );
keystore.load( new FileInputStream( keyStoreFilename ), keyStorePassword.toCharArray() );
KeyManagerFactory kmf = KeyManagerFactory.getInstance( SECURE_ALGORITHM );
kmf.init( keystore, keyPassword.toCharArray() );
SSLContext sslc = SSLContext.getInstance( SECURE_PROTOCOL );
sslc.init( kmf.getKeyManagers(), null, null );
ServerSocketFactory ssf = sslc.getServerSocketFactory();
SSLServerSocket serverSocket = ( SSLServerSocket ) ssf.createServerSocket( serverPort );
serverSocket.setNeedClientAuth( requireClientAuth );
return serverSocket;
 

你可能感兴趣的:(xml,.net,Security,sun,idea)