Package org.jolokia.jvmagent.security
Class KeyStoreUtil
java.lang.Object
org.jolokia.jvmagent.security.KeyStoreUtil
Utility class for handling keystores
- Since:
- 30/09/15
- Author:
- roland
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidupdateWithCaPem(KeyStore pTrustStore, File pCaCert) Update a keystore with a CA certificatestatic voidupdateWithSelfSignedServerCertificate(KeyStore pKeyStore) Update the given keystore with a self-signed server certificate.static voidupdateWithServerPems(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword) Update a key store with the keys found in a server PEM and its key file.
-
Method Details
-
updateWithCaPem
public static void updateWithCaPem(KeyStore pTrustStore, File pCaCert) throws IOException, CertificateException, KeyStoreException Update a keystore with a CA certificate- Parameters:
pTrustStore- the keystore to updatepCaCert- CA cert as PEM used for the trust store- Throws:
IOExceptionCertificateExceptionKeyStoreException
-
updateWithServerPems
public static void updateWithServerPems(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword) throws IOException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException Update a key store with the keys found in a server PEM and its key file.- Parameters:
pKeyStore- keystore to updatepServerCert- server certificatepServerKey- server keypKeyAlgo- algorithm used in the keystore (e.g. "RSA")pPassword- password to use for the key file. must not be null, usechar[0]for an empty password.- Throws:
IOExceptionCertificateExceptionNoSuchAlgorithmExceptionInvalidKeySpecExceptionKeyStoreException
-
updateWithSelfSignedServerCertificate
public static void updateWithSelfSignedServerCertificate(KeyStore pKeyStore) throws NoSuchAlgorithmException, KeyStoreException Update the given keystore with a self-signed server certificate. This can be used if no server certificate is provided from the outside and no SSL verification is used by the client.- Parameters:
pKeyStore- keystore to update- Throws:
NoSuchAlgorithmExceptionKeyStoreException
-