| Constructor and Description |
|---|
KeyStoreUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addPrivateKey(KeyStore keyStore,
File pemKeyFile,
char[] passwordChars,
List<Certificate> certChain)
Adds a private key to the specified key store from the passed private key file and certificate chain.
|
static PrivateKey |
createPrivateKey(File pemKeyFile,
char[] passwordChars)
Creates a
PrivateKey instance from the passed private key PEM format file and certificate chain. |
static KeyStore |
loadKeyStore(File file,
String password)
Attempts to load the specified file as a
KeyStore, determining the key store type from the file extension. |
public static KeyStore loadKeyStore(File file, String password) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException
KeyStore, determining the key store type from the file extension.file - the file containing the key store to be loaded.password - password for the key store file.KeyStore instance loaded from the specified file.KeyStoreException - if no KeyStore provider supports the key store type (inferred from the key store file extension).NoSuchAlgorithmException - if an unknown algorithm is used to check key store identity.CertificateException - if certificates from the key store could not be loaded.IOException - if there is a problem accessing the key store file.public static void addPrivateKey(KeyStore keyStore, File pemKeyFile, char[] passwordChars, List<Certificate> certChain) throws IOException, GeneralSecurityException
keyStore - The key store to receive the private key.pemKeyFile - A PEM format file containing the private key.passwordChars - The password that protects the private key.certChain - The certificate chain to associate with the private key.IOException - if the key store file cannot be readGeneralSecurityException - if a cryptography problem is encountered.public static PrivateKey createPrivateKey(File pemKeyFile, char[] passwordChars) throws IOException, GeneralSecurityException
PrivateKey instance from the passed private key PEM format file and certificate chain.pemKeyFile - A PEM format file containing the private key.passwordChars - The password that protects the private key.IOException - if the file cannot be read.GeneralSecurityException - if a cryptography problem is encountered.Copyright © 2019 International Business Machines Corporation. All rights reserved.