protected String getTruststorePassword() { String truststorePassword = (String) attributes.get("truststorePass"); if (truststorePassword == null) { truststorePassword = System.getProperty("javax.net.ssl.trustStorePassword"); if (truststorePassword == null) { truststorePassword = getKeystorePassword(); } } return truststorePassword; }
/** * Gets the SSL server's truststore. */ protected KeyStore getTrustStore() throws IOException { KeyStore ts = null; String truststore = (String) attributes.get("truststore"); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Truststore file= {0}", truststore); } String truststoreType = (String) attributes.get("truststoreType"); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Truststore type= {0}", truststoreType); } String truststorePassword = getTruststorePassword(); if (truststore != null && truststorePassword != null) { ts = getStore(truststoreType, truststore, truststorePassword); } return ts; }
@Override public ServerSocket createSocket(int port) throws IOException { if (!initialized) { init(); } ServerSocket socket = sslProxy.createServerSocket(port); initServerSocket(socket); return socket; }
/** * Configures the given SSL server socket with the requested cipher suites, protocol versions, and need for client * authentication */ protected void initServerSocket(ServerSocket ssocket) { if (!(ssocket instanceof SSLServerSocket)) { throw new IllegalArgumentException("The ServerSocket has to be SSLServerSocket"); } SSLServerSocket socket = (SSLServerSocket) ssocket; if (attributes.get("ciphers") != null) { socket.setEnabledCipherSuites(enabledCiphers); } String requestedProtocols = (String) attributes.get("protocols"); setEnabledProtocols(socket, getEnabledProtocols(socket, requestedProtocols)); // we don't know if client auth is needed - // after parsing the request we may re-handshake if(clientAuthNeed) { socket.setNeedClientAuth(clientAuthNeed); } else { socket.setWantClientAuth(clientAuthWant); } } }
/** * Gets the SSL server's keystore. */ protected KeyStore getKeystore(String pass) throws IOException { String keystoreFile = (String) attributes.get("keystore"); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Keystore file= {0}", keystoreFile); } String keystoreType = (String) attributes.get("keystoreType"); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Keystore type= {0}", keystoreType); } return getStore(keystoreType, keystoreFile, pass); } /*
/** * Configures the given SSL server socket with the requested cipher suites, protocol versions, and need for client * authentication */ protected void initServerSocket(ServerSocket ssocket) { SSLServerSocket socket = (SSLServerSocket) ssocket; if (attributes.get("ciphers") != null) { socket.setEnabledCipherSuites(enabledCiphers); } String requestedProtocols = (String) attributes.get("protocols"); setEnabledProtocols(socket, getEnabledProtocols(socket, requestedProtocols)); // we don't know if client auth is needed - // after parsing the request we may re-handshake if(clientAuthNeed) { socket.setNeedClientAuth(clientAuthNeed); } else { socket.setWantClientAuth(clientAuthWant); } } }
/** * Gets the SSL server's keystore. */ protected KeyStore getKeystore(String pass) throws IOException { String keystoreFile = (String) attributes.get("keystore"); if (logger.isLoggable(Level.FINE)) { logger.fine("Keystore file= " + keystoreFile); } String keystoreType = (String) attributes.get("keystoreType"); if (logger.isLoggable(Level.FINE)) { logger.fine("Keystore type= " + keystoreType); } return getStore(keystoreType, keystoreFile, pass); } /*
@Override public ServerSocket createSocket(int port, int backlog, InetAddress ifAddress) throws IOException { if (!initialized) { init(); } ServerSocket socket = sslProxy.createServerSocket(port, backlog, ifAddress); initServerSocket(socket); return socket; }
/** * Gets the SSL server's truststore. */ protected KeyStore getTrustStore() throws IOException { KeyStore ts = null; String truststore = (String) attributes.get("truststore"); if (logger.isLoggable(Level.FINE)) { logger.fine("Truststore file= " + truststore); } String truststoreType = (String) attributes.get("truststoreType"); if (logger.isLoggable(Level.FINE)) { logger.fine("Truststore type= " + truststoreType); } String truststorePassword = getTruststorePassword(); if (truststore != null && truststorePassword != null) { ts = getStore(truststoreType, truststore, truststorePassword); } return ts; }
protected String getTruststorePassword() { String truststorePassword = (String) attributes.get("truststorePass"); if (truststorePassword == null) { truststorePassword = System.getProperty("javax.net.ssl.trustStorePassword"); if (truststorePassword == null) { truststorePassword = getKeystorePassword(); } } return truststorePassword; }
@Override public ServerSocket createSocket(int port, int backlog) throws IOException { if (!initialized) { init(); } ServerSocket socket = sslProxy.createServerSocket(port, backlog); initServerSocket(socket); return socket; }
public ServerSocket createSocket(int port, int backlog) throws IOException { if (!initialized) { init(); } ServerSocket socket = sslProxy.createServerSocket(port, backlog); initServerSocket(socket); return socket; }
public ServerSocket createSocket(int port, int backlog, InetAddress ifAddress) throws IOException { if (!initialized) { init(); } ServerSocket socket = sslProxy.createServerSocket(port, backlog, ifAddress); initServerSocket(socket); return socket; }
public ServerSocket createSocket(int port) throws IOException { if (!initialized) { init(); } ServerSocket socket = sslProxy.createServerSocket(port); initServerSocket(socket); return socket; }