protected X509Certificate wireUpSslWithCyberVilliansCAOdo ( String host , SslListener listener ) { host = requestOriginalHostName . get ( ) ; // 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 ) ; } }
This function wires up a SSL Listener with the cyber villians root CA and cert with the correct CNAME for the request