public class KeyStoreUtil extends Object
| Constructor and Description |
|---|
KeyStoreUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addCertificate(File keystoreFile,
char[] storePass,
String alias,
Certificate cert)
Add a certificate to the KeyStore
|
static void |
addCertificate(String keyStoreType,
File keystoreFile,
char[] storePass,
String alias,
Certificate cert)
Add a certificate to the KeyStore
|
static KeyStore |
createKeyStore(String keyStoreType,
char[] keyStorePWD)
Create new empty keystore with specified keyStoreType and keyStorePWD
|
static KeyPair |
generateKeyPair(String algo)
Generate a Key Pair
|
static KeyStore |
getKeyStore(File keyStoreFile,
char[] storePass)
Get the KeyStore
|
static KeyStore |
getKeyStore(InputStream ksStream,
char[] storePass)
Get the Key Store
Note: This method wants the InputStream to be not null.
|
static KeyStore |
getKeyStore(String fileURL,
char[] storePass)
Get the Keystore given the url to the keystore file as a string
|
static KeyStore |
getKeyStore(String keyStoreType,
File keyStoreFile,
char[] storePass)
Get the KeyStore
|
static KeyStore |
getKeyStore(String keyStoreType,
InputStream ksStream,
char[] storePass)
Get the Key Store
Note: This method wants the InputStream to be not null.
|
static KeyStore |
getKeyStore(String keyStoreType,
String fileURL,
char[] storePass)
Get the Keystore given the url to the keystore file as a string
|
static KeyStore |
getKeyStore(String keyStoreType,
URL url,
char[] storePass)
Get the Keystore given the URL to the keystore
|
static KeyStore |
getKeyStore(URL url,
char[] storePass)
Get the Keystore given the URL to the keystore
|
static KeyPair |
getPrivateKey(KeyStore keystore,
String alias,
char[] password)
Get the key pair from the keystore
|
static PublicKey |
getPublicKey(KeyStore ks,
String alias,
char[] password)
Get the Public Key from the keystore
|
public static KeyStore getKeyStore(File keyStoreFile, char[] storePass) throws GeneralSecurityException, IOException
keyStoreFile - storePass - GeneralSecurityExceptionIOExceptionpublic static KeyStore getKeyStore(String fileURL, char[] storePass) throws GeneralSecurityException, IOException
fileURL - storePass - GeneralSecurityExceptionIOExceptionpublic static KeyStore getKeyStore(URL url, char[] storePass) throws GeneralSecurityException, IOException
url - storePass - GeneralSecurityExceptionIOExceptionpublic static KeyStore getKeyStore(InputStream ksStream, char[] storePass) throws GeneralSecurityException, IOException
ksStream - storePass - GeneralSecurityExceptionIOExceptionIllegalArgumentException - if ksStream is nullpublic static KeyStore getKeyStore(String keyStoreType, File keyStoreFile, char[] storePass) throws GeneralSecurityException, IOException
keyStoreType - or null for defaultkeyStoreFile - storePass - GeneralSecurityExceptionIOExceptionpublic static KeyStore getKeyStore(String keyStoreType, String fileURL, char[] storePass) throws GeneralSecurityException, IOException
keyStoreType - or null for defaultfileURL - storePass - GeneralSecurityExceptionIOExceptionpublic static KeyStore getKeyStore(String keyStoreType, URL url, char[] storePass) throws GeneralSecurityException, IOException
keyStoreType - or null for defaulturl - storePass - GeneralSecurityExceptionIOExceptionpublic static KeyStore getKeyStore(String keyStoreType, InputStream ksStream, char[] storePass) throws GeneralSecurityException, IOException
keyStoreType - or null for defaultksStream - storePass - GeneralSecurityExceptionIOExceptionIllegalArgumentException - if ksStream is nullpublic static KeyPair generateKeyPair(String algo) throws GeneralSecurityException
algo - (RSA, DSA etc)GeneralSecurityExceptionpublic static PublicKey getPublicKey(KeyStore ks, String alias, char[] password) throws KeyStoreException, NoSuchAlgorithmException, GeneralSecurityException
ks - alias - password - GeneralSecurityExceptionKeyStoreExceptionNoSuchAlgorithmExceptionpublic static void addCertificate(File keystoreFile, char[] storePass, String alias, Certificate cert) throws GeneralSecurityException, IOException
keystoreFile - storePass - alias - cert - GeneralSecurityExceptionIOExceptionpublic static void addCertificate(String keyStoreType, File keystoreFile, char[] storePass, String alias, Certificate cert) throws GeneralSecurityException, IOException
keystoreFile - storePass - alias - cert - GeneralSecurityExceptionIOExceptionpublic static KeyPair getPrivateKey(KeyStore keystore, String alias, char[] password) throws Exception
keystore - alias - password - ExceptionCopyright © 2017 JBoss by Red Hat. All rights reserved.