Package net.lightbody.bmp.proxy.selenium

Examples of net.lightbody.bmp.proxy.selenium.KeyStoreManager


   */
  public static KeyStoreManager getKeyStoreManager(String hostname) throws Exception {
    File root = getKeyStoreRoot(hostname);

      // create entry
      KeyStoreManager keyStoreManager = new KeyStoreManager(root);
     
      // under the hood this will generate the cert if it doesn't exist
      keyStoreManager.getCertificateByHostname(hostname);
     
      // use this since getCertificateByHostname always returns null, but hostname == alias for our purpose
      X509Certificate cert = keyStoreManager.getCertificateByAlias(hostname);
      try {
        cert.checkValidity();
      } catch (CertificateExpiredException cee) {
        // if the cert is expired we should destroy it and recursively call this function
        keyStoreManager = null;
View Full Code Here


            hostname = "cybervillainsCA";
            response.setContentType("application/pkix-cert ");
        }

        // get the cert for the hostname
        KeyStoreManager keyStoreManager = com.groupon.odo.bmp.Utils.getKeyStoreManager(hostname);

        if (hostname.equals("cybervillainsCA")) {
            // get the cybervillians cert from resources
            File root = new File("seleniumSslSupport" + File.separator + hostname);

            // return the root cert
            Files.copy(new File(root.getAbsolutePath() + File.separator + hostname + ".cer").toPath(), response.getOutputStream());
            response.flushBuffer();
        } else {
            // return the cert for the appropriate alias
            response.getOutputStream().write(keyStoreManager.getCertificateByAlias(hostname).getEncoded());
            response.flushBuffer();
        }


    }
View Full Code Here

        // Add cybervillians CA(from browsermob)
        try {
          // see https://github.com/webmetrics/browsermob-proxy/issues/105
            String escapedHost = host.replace('*', '_');
           
            KeyStoreManager keyStoreManager = Utils.getKeyStoreManager(escapedHost);
            keyStoreManager.getKeyStore().deleteEntry(KeyStoreManager._caPrivKeyAlias);
            keyStoreManager.persist();
            listener.setKeystore(new File("seleniumSslSupport" + File.separator + escapedHost + File.separator + "cybervillainsCA.jks").getAbsolutePath());
           
            return keyStoreManager.getCertificateByAlias(escapedHost);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

TOP

Related Classes of net.lightbody.bmp.proxy.selenium.KeyStoreManager

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.