public final KeyStore decodeKeyStore ( String base64String , char [ ] password ) { logger . entry ( ) ; byte [ ] bytes = Base64Utils . decode ( base64String ) ; try ( ByteArrayInputStream in = new ByteArrayInputStream ( bytes ) ) { KeyStore keyStore = KeyStore . getInstance ( KEY_STORE_FORMAT ) ; keyStore . load ( in , password ) ; logger . exit ( ) ; return keyStore ; } catch ( IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e ) { RuntimeException exception = new RuntimeException ( "An unexpected exception occurred while attempting to decode a keystore." , e ) ; logger . error ( exception . toString ( ) ) ; throw exception ; } }
This method decodes a PKCS12 format key store from its encrypted byte stream .