public synchronized void addCertAndPrivateKey ( String hostname , final X509Certificate cert , final PrivateKey privKey ) throws KeyStoreException , CertificateException , NoSuchAlgorithmException { // String alias = ThumbprintUtil.getThumbprint(cert); _ks . deleteEntry ( hostname ) ; _ks . setCertificateEntry ( hostname , cert ) ; _ks . setKeyEntry ( hostname , privKey , _keypassword , new java . security . cert . Certificate [ ] { cert } ) ; if ( persistImmediately ) { persist ( ) ; } }
Stores a new certificate and its associated private key in the keystore .