Package com.sun.net.ssl

Examples of com.sun.net.ssl.SSLContext


                        }
                    }
                }
                trustmanagers = createTrustManagers(keystore);
            }
            SSLContext sslcontext = SSLContext.getInstance("SSL");
            sslcontext.init(keymanagers, trustmanagers, null);
            return sslcontext;
        } catch (NoSuchAlgorithmException e) {
            LOG.error(e.getMessage(), e);
            throw new AuthSSLInitializationError("Unsupported algorithm exception: " + e.getMessage());
        } catch (KeyStoreException e) {
View Full Code Here


        super();
    }

    private static SSLContext createEasySSLContext() {
        try {
            SSLContext context = SSLContext.getInstance("SSL");
            context.init(
              null,
              new TrustManager[] {new EasyX509TrustManager(null)},
              null);
            return context;
        } catch (Exception e) {
View Full Code Here

     * @throws Exception
     */
    protected com.sun.net.ssl.SSLContext getContext() throws Exception {

        try {
            SSLContext sc = SSLContext.getInstance("SSL");

            sc.init(null, // we don't need no stinkin KeyManager
                    new TrustManager[]{new FakeX509TrustManager()},
                    new java.security.SecureRandom());
            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage("ftsf00"));
            }
View Full Code Here

            if(attributes == null) {
                //No configuration specified. Get the default.
                sslFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
            } else {
                //Configuration specified in wsdd.
                SSLContext context = getContext();
                sslFactory = context.getSocketFactory();
            }
        } catch (Exception e) {
            if (e instanceof IOException) {
                throw (IOException) e;
            }
View Full Code Here

     * @throws Exception
     */
    protected com.sun.net.ssl.SSLContext getContext() throws Exception {

        try {
            SSLContext sc = SSLContext.getInstance("SSL");

            sc.init(null, // we don't need no stinkin KeyManager
                    new TrustManager[]{new FakeX509TrustManager()},
                    new java.security.SecureRandom());
            if (log.isDebugEnabled()) {
                log.debug(JavaUtils.getMessage("ftsf00"));
            }
View Full Code Here

            if(attributes == null) {
                //No configuration specified. Get the default.
                sslFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
            } else {
                //Configuration specified in wsdd.
                SSLContext context = getContext();
                sslFactory = context.getSocketFactory();
            }
        } catch (Exception e) {
            if (e instanceof IOException) {
                throw (IOException) e;
            }
View Full Code Here

    protected ServerSocket createServerSocket(int port, int backlog, InetAddress add)
        throws Exception
    {
        SecurityTool.setup();
   
        SSLContext context = SSLContext.getInstance(SecurityTool.getSecurityProtocol());
         
        KeyManagerFactory keyManagerFactory =
            KeyManagerFactory.getInstance(SecurityTool.getKeyManagerType());
           
        KeyStore keyStore = KeyStore.getInstance(SecurityTool.getKeyStoreType());
           
        keyStore.load(new FileInputStream(SecurityTool.getKeyStore()),
            SecurityTool.getKeyStorePassword().toCharArray());
           
        keyManagerFactory.init(keyStore, SecurityTool.getKeyStorePassword().toCharArray());
           
        context.init(keyManagerFactory.getKeyManagers(), null, null);
        SSLServerSocketFactory sslSrvFact = context.getServerSocketFactory();
        return (SSLServerSocket) sslSrvFact.createServerSocket(port);
    }
View Full Code Here

        } catch (Throwable t) {
            ;
        }

        // Create an SSL context used to create an SSL socket factory
        SSLContext context = SSLContext.getInstance(protocol);

        // Create the key manager factory used to extract the server key
        KeyManagerFactory keyManagerFactory =
            KeyManagerFactory.getInstance(algorithm);
        keyManagerFactory.init(keyStore, keystorePass.toCharArray());

        // Create the trust manager factory used for checking certificates
        /*
          trustManagerFactory = TrustManagerFactory.getInstance(algorithm);
          trustManagerFactory.init(keyStore);
        */

        // Initialize the context with the key managers
        context.init(keyManagerFactory.getKeyManagers(), null,
                     new java.security.SecureRandom());

        // Create the proxy and return
        sslProxy = context.getServerSocketFactory();

    }
View Full Code Here

            keystore.load(url.openStream(), "nopassword".toCharArray());
            TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(
                    TrustManagerFactory.getDefaultAlgorithm());
            tmfactory.init(keystore);
            TrustManager[] trustmanagers = tmfactory.getTrustManagers();
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            sslcontext.init(null, trustmanagers, null);
            return sslcontext;
        } catch (Exception ex) {
            // this is not the way a sane exception handling should be done
            // but for our simple HTTP testing framework this will suffice
            LOG.error(ex.getMessage(), ex);
View Full Code Here

            keystore.load(url.openStream(), "nopassword".toCharArray());
            KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(
                    KeyManagerFactory.getDefaultAlgorithm());
            kmfactory.init(keystore, "nopassword".toCharArray());
            KeyManager[] keymanagers = kmfactory.getKeyManagers();
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            sslcontext.init(keymanagers, null, null);
            return sslcontext;
        } catch (Exception ex) {
            // this is not the way a sane exception handling should be done
            // but for our simple HTTP testing framework this will suffice
            LOG.error(ex.getMessage(), ex);
View Full Code Here

TOP

Related Classes of com.sun.net.ssl.SSLContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.