public SVNCertificateAuthenticationBuilder(CertificateCredentials c) { String password = c.getPassword().getPlainText(); this.password = Scrambler.scramble(password); char[] passwordChars = password.toCharArray(); KeyStore src = c.getKeyStore(); for (Enumeration<String> e = src.aliases(); e.hasMoreElements(); ) { String alias = e.nextElement();
/** * Helper in place to allow us to define out HttpClient SSL context * * @param ignoreUnverifiedSSL * @param credentials * @return * @throws UnrecoverableKeyException * @throws NoSuchAlgorithmException * @throws KeyStoreException * @throws KeyManagementException */ private SSLContext buildSslContext(boolean ignoreUnverifiedSSL, Credentials credentials) throws UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { SSLContextBuilder customContext = SSLContexts.custom(); if (credentials instanceof CertificateCredentials) { customContext = customContext.loadKeyMaterial(((CertificateCredentials) credentials).getKeyStore(), ((CertificateCredentials) credentials).getPassword().getPlainText().toCharArray()); } if (ignoreUnverifiedSSL) { TrustStrategy easyStrategy = new TrustStrategy() { @Override public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { return true; } }; customContext = customContext .loadTrustMaterial(null, easyStrategy); } return customContext.useTLS().build(); }
CertificateCredentials certificateCredentials = (CertificateCredentials) credentials; withSslConfig(new KeystoreSSLConfig( certificateCredentials.getKeyStore(), certificateCredentials.getPassword().getPlainText() ));