Package org.apache.commons.ssl

Examples of org.apache.commons.ssl.KeyMaterial


        URI targetURI = getTargetURI(properties, true);
        String factory;
        String scheme = targetURI.getScheme();
        int port = targetURI.getPort();
        org.apache.commons.httpclient.protocol.Protocol protocol;
        KeyMaterial keyMaterial = null;
        ProtocolSocketFactory socketFactory;

        if(!scheme.startsWith("http")) {
            // We're only interested in HTTP for this...
            return;
View Full Code Here


            // Try it as a File resource...
            if(keyStoreStream == null) {
                File keyStoreFile = new File(keyStore);

                if(keyStoreFile.exists() && !keyStoreFile.isDirectory()) {
                    return new KeyMaterial(new FileInputStream(keyStoreFile), keyStorePassword.toCharArray());
                }
            } else {
                return new KeyMaterial(keyStoreStream, keyStorePassword.toCharArray());
            }

            // Try it as a URI resource...
            if(keyStoreStream == null) {
                try {
                    URI fileURI = new URI(keyStore);                   
                    if(fileURI.isAbsolute()) {
                        return new KeyMaterial(fileURI.toURL().openStream(), keyStorePassword.toCharArray());
                    }
                } catch (URISyntaxException e) {
                    throw new ConfigurationException("Failed to load keystore '" + keyStore + "'.");
                }
            }
View Full Code Here

      HttpSecureProtocol httpSecureProtocol = new HttpSecureProtocol();
      // setup keyStore
      File keystore = new File(keyStoreFilePath);
      char[] keyStorePasswordInCharArray = keyStorePassword.toCharArray();
     
      KeyMaterial keyMaterial = new KeyMaterial(keystore,
          keyStorePasswordInCharArray);
     
      // setup trustStore
      File TrustMaterial = new File(trustStoreFilePath);
      char[] trustStorePasswordPasswordInCharArray = trustStorePassword
View Full Code Here

        log.info( "Initializing KeyStore" );

        File f = new File( keyStore );
        if( f.exists() )
        {
          KeyMaterial km = null;
          try
          {
            km = new KeyMaterial( keyStore, pwd );
            log.info( "Set KeyMaterial from file [" + keyStore + "]" );
          }
          catch( GeneralSecurityException gse )
          {
            SoapUI.logError( gse );
View Full Code Here

      int ix = sslConfig.lastIndexOf( ' ' );
      String keyStore = sslConfig.substring( 0, ix );
      String pwd = sslConfig.substring( ix + 1 );

      factory.setKeyMaterial( new KeyMaterial( keyStore, pwd.toCharArray() ) );
      factoryMap.put( sslConfig, factory );

      return enableSocket( ( SSLSocket )factory.createSocket( host, port, localAddress, localPort, params ) );
    }
    catch( Exception gse )
View Full Code Here

                File f = new File(keyStoreUrl);
                if (f.exists()) {
                    log.info("Initializing KeyStore");

                    try {
                        KeyMaterial km = new KeyMaterial(f, pwd);
                        keyStore = km.getKeyStore();
                    } catch (Exception e) {
                        SoapUI.logError(e);
                    }
                }
            }
View Full Code Here

                if (f.exists()) {
                    log.info("Initializing Keystore from [" + keyStore + "]");

                    try {
                        KeyMaterial km = new KeyMaterial(f, pwd.toCharArray());
                        ks = km.getKeyStore();
                    } catch (Exception e) {
                        SoapUI.logError(e);
                        pwd = null;
                    }
                }
View Full Code Here

        if (keystoreUrl != null) {
            char[] ksPass = null;
            if (keystorePassword != null) {
                ksPass = keystorePassword.toCharArray();
            }
            KeyMaterial km = new KeyMaterial(keystoreUrl, ksPass);
            super.setKeyMaterial(km);
        }

        // prepare trust material1
        if (truststoreUrl != null) {
            char[] tsPass = null;
            if (truststorePassword != null) {
                tsPass = truststorePassword.toCharArray();
            }
            TrustMaterial tm = new KeyMaterial(truststoreUrl, tsPass);
            super.setTrustMaterial(tm);
        }
    }
View Full Code Here

     * @throws KeyManagementException
     */
    public TrustSSLProtocolSocketFactory(String pathToTrustStore, char[] password)
        throws GeneralSecurityException, IOException {
        super();
        KeyMaterial km = new KeyMaterial(pathToTrustStore, password);
        super.setTrustMaterial(km);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.ssl.KeyMaterial

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.