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 voidupdateWithCaCertificates(KeyStore pTrustStore, File pCaCerts) Update a keystore with a CA certificate (stored as certificate entry)static voidupdateWithSelfSignedServerCertificate(KeyStore pKeyStore, JolokiaServerConfig pConfig) Update the given keystore with a self-signed server certificate.static voidupdateWithServerCertificate(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword) Update a keystore with a Server certificate and key (stored as (trusted) key entry)
-
Method Details
-
updateWithCaCertificates
public static void updateWithCaCertificates(KeyStore pTrustStore, File pCaCerts) throws IOException, CertificateException, KeyStoreException Update a keystore with a CA certificate (stored as certificate entry)- Parameters:
pTrustStore- the keystore to updatepCaCerts- CA certificate in PEM or DER format - may contain more entries (certificates) if in PEM format- Throws:
IOExceptionCertificateExceptionKeyStoreException
-
updateWithServerCertificate
public static void updateWithServerCertificate(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword) throws IOException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException Update a keystore with a Server certificate and key (stored as (trusted) key entry)- Parameters:
pKeyStore- keystore to updatepServerCert- server certificate in PEM or DER format - should contain one certificatepServerKey- server key in DER/PEM format encoded using PKCS#1 or PKCS#8 matching thepServerCertpKeyAlgo- algorithm used in the keystore (e.g. "RSA")pPassword- password to use for the key file. must not be null, usenew char[0]for an empty password.- Throws:
IOExceptionCertificateExceptionNoSuchAlgorithmExceptionInvalidKeySpecExceptionKeyStoreException
-
updateWithSelfSignedServerCertificate
public static void updateWithSelfSignedServerCertificate(KeyStore pKeyStore, JolokiaServerConfig pConfig) 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 updatepConfig-- Throws:
NoSuchAlgorithmExceptionKeyStoreException
-