Package com.browserup.bup.mitm.util
Class KeyStoreUtil
- java.lang.Object
-
- com.browserup.bup.mitm.util.KeyStoreUtil
-
public class KeyStoreUtil extends java.lang.ObjectUtility for loading, saving, and manipulatingKeyStores.
-
-
Constructor Summary
Constructors Constructor Description KeyStoreUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.security.KeyStorecreateEmptyKeyStore(java.lang.String keyStoreType, java.lang.String provider)Creates and initializes an empty KeyStore using the specified keyStoreType.static java.security.KeyStorecreateRootCertificateKeyStore(java.lang.String keyStoreType, java.security.cert.X509Certificate certificate, java.lang.String privateKeyAlias, java.security.PrivateKey privateKey, java.lang.String privateKeyPassword, java.lang.String provider)Creates a new KeyStore containing the specified root certificate and private key.static javax.net.ssl.KeyManager[]getKeyManagers(java.security.KeyStore keyStore, java.lang.String keyStorePassword, java.lang.String keyManagerAlgorithm, java.lang.String provider)Retrieve the KeyManagers for the specified KeyStore.
-
-
-
Method Detail
-
createEmptyKeyStore
public static java.security.KeyStore createEmptyKeyStore(java.lang.String keyStoreType, java.lang.String provider)Creates and initializes an empty KeyStore using the specified keyStoreType.- Parameters:
keyStoreType- type of key store to initialize, or null to use the system defaultprovider- JCA provider to use, or null to use the system default- Returns:
- a new KeyStore
-
createRootCertificateKeyStore
public static java.security.KeyStore createRootCertificateKeyStore(java.lang.String keyStoreType, java.security.cert.X509Certificate certificate, java.lang.String privateKeyAlias, java.security.PrivateKey privateKey, java.lang.String privateKeyPassword, java.lang.String provider)Creates a new KeyStore containing the specified root certificate and private key.- Parameters:
keyStoreType- type of the generated KeyStore, such as PKCS12 or JKScertificate- root certificate to add to the KeyStoreprivateKeyAlias- alias for the private key in the KeyStoreprivateKey- private key to add to the KeyStoreprivateKeyPassword- password for the private keyprovider- JCA provider to use, or null to use the system default- Returns:
- new KeyStore containing the root certificate and private key
-
getKeyManagers
public static javax.net.ssl.KeyManager[] getKeyManagers(java.security.KeyStore keyStore, java.lang.String keyStorePassword, java.lang.String keyManagerAlgorithm, java.lang.String provider)Retrieve the KeyManagers for the specified KeyStore.- Parameters:
keyStore- the KeyStore to retrieve KeyManagers fromkeyStorePassword- the KeyStore passwordkeyManagerAlgorithm- key manager algorithm to use, or null to use the system defaultprovider- JCA provider to use, or null to use the system default- Returns:
- KeyManagers for the specified KeyStore
-
-