public static void addPrivateKey ( KeyStore keyStore , File pemKeyFile , char [ ] passwordChars , List < Certificate > certChain ) throws IOException , GeneralSecurityException { final String methodName = "addPrivateKey" ; logger . entry ( methodName , pemKeyFile , certChain ) ; PrivateKey privateKey = createPrivateKey ( pemKeyFile , passwordChars ) ; keyStore . setKeyEntry ( "key" , privateKey , passwordChars , certChain . toArray ( new Certificate [ certChain . size ( ) ] ) ) ; logger . exit ( methodName ) ; }
Adds a private key to the specified key store from the passed private key file and certificate chain .