FileDocCategorySizeDatePackage
SSLServerWithContext.javaAPI DocExample900Mon Jan 15 12:11:06 GMT 2001javasec.samples.ch14

SSLServerWithContext

public class SSLServerWithContext extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        SSLContext sc = SSLContext.getInstance("TLS");
        KeyManagerFactory kmf =
                        KeyManagerFactory.getInstance("SunX509");
        KeyStore ks = KeyStore.getInstance("jceks");
        char[] password = args[1].toCharArray();
        ks.load(new FileInputStream(args[0]), null);
        kmf.init(ks, password);
        sc.init(kmf.getKeyManagers(), null, null);

        ServerSocketFactory ssf = sc.getServerSocketFactory();
        ServerSocket ss = ssf.createServerSocket(9096);

        while (true) {
            new SSLSimpleServer(ss.accept()).start();
        }