コード例 #1
0
 /**
  * Get the TrustManagers for the specified trust store.
  *
  * @param tsFile The trust store file
  * @param tsPass The trust store password
  * @return The TrustManagers that can manager the specified trust store.
  * @throws Exception
  */
 protected TrustManager[] getTrustManagers(String tsFile, String tsPass) throws Exception {
   tsFile = JavaKeyStoreHandler.getTrustStoreName(tsFile);
   tsPass = JavaKeyStoreHandler.getTrustStorePassword(tsPass);
   KeyStore ts = KeyStore.getInstance("JKS");
   ts.load(new FileInputStream(tsFile), tsPass.toCharArray());
   TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
   tmf.init(ts);
   return tmf.getTrustManagers();
 }
コード例 #2
0
  public String logMessageSetting() {
    String messageConfig = "GNHTTPConnection Settings:\r\n";
    messageConfig +=
        "   URL["
            + url
            + "]\r\n"
            +
            // "   Using Proxy?" +  isUsingProxy() +
            // "   Proxy Setting[" + auth_username + ":" + auth_password + "@" +
            // getConfig_http_proxy_url() + ":" + getConfig_http_proxy_port() + "]\r\n" +
            "   Timeout["
            + timeout
            + "]\r\n";
    messageConfig +=
        "   auth server["
            + authenticateServer
            + "]\r\n"
            + "   verify hostname["
            + verifyServerHostname
            + "]\r\n\r\n"
            + "   keystorefile["
            + keyStoreFile
            + "]\r\n"
            + "   keystorepass["
            + keyStorePassword
            + "]\r\n";

    messageConfig +=
        "   truststorefile["
            + JavaKeyStoreHandler.getTrustStoreName(trustStoreFile)
            + "]\r\n"
            + "   truststorepass["
            + JavaKeyStoreHandler.getTrustStorePassword(trustStorePassword)
            + "]\r\n";

    messageConfig +=
        "   java.protocol.handler.pkgs["
            + System.getProperty("java.protocol.handler.pkgs")
            + "]\r\n"
            + "   javax.net.ssl.trustStore = "
            + System.getProperty("javax.net.ssl.trustStore")
            + "]\r\n"
            + "   javax.net.ssl.trustStorePassword = "******"javax.net.ssl.trustStorePassword")
            + "]\r\n"
            + "   javax.net.ssl.keyStore = "
            + System.getProperty("javax.net.ssl.keyStore")
            + "]\r\n"
            + "   javax.net.ssl.keyStorePassword = "******"javax.net.ssl.keyStorePassword")
            + "]\r\n";
    return messageConfig;
  }