use of com.github.tomakehurst.wiremock.http.ssl.CertificateAuthority in project wiremock by wiremock.
the class SslContexts method buildKeyStore.
private static X509KeyStore buildKeyStore(KeyStoreSettings browserProxyCaKeyStore) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, CertificateGenerationUnsupportedException {
final CertificateAuthority certificateAuthority = CertificateAuthority.generateCertificateAuthority();
KeyStore keyStore = KeyStore.getInstance(browserProxyCaKeyStore.type());
char[] password = browserProxyCaKeyStore.password().toCharArray();
keyStore.load(null, password);
keyStore.setKeyEntry("wiremock-ca", certificateAuthority.key(), password, certificateAuthority.certificateChain());
browserProxyCaKeyStore.getSource().save(keyStore);
return new X509KeyStore(keyStore, password);
}
Aggregations