public class KeyStoreUtil extends Object
| Constructor and Description |
|---|
KeyStoreUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendCertificateToKeyStore(KeyStore keyStore,
String keyAlias,
String pemCert)
Append a certificate to the given key store
|
static void |
appendKeyToKeyStore(KeyStore keyStore,
String keyAlias,
InputStream certificateInputStream,
InputStream privatekeyInputStream,
char[] password)
Append a certificate and private key to a keystore.
|
public static void appendKeyToKeyStore(KeyStore keyStore, String keyAlias, InputStream certificateInputStream, InputStream privatekeyInputStream, char[] password) throws IOException
keyStore - where to append the certificate and private key tokeyAlias - the alias of the keycertificateInputStream - the inputStream containing the certificate in the PEM formatprivatekeyInputStream - the input stream containing the private key in the DER formatpassword - the password on the key
Generate your private key: openssl genrsa -out something.key 1024
Show the PEM private key: openssl asn1parse -inform pem -dump -i
-in something.key
Translate the key to pkcs8 DER format: openssl pkcs8 -topk8
-inform PEM -outform DER -in something.key -nocrypt >
something.pkcs8.der
Show the DER private key: openssl asn1parse -inform der -dump -i
-in something.pkcs8.der
Generate a certificate request: openssl req -new -key
something.key -out something.csr
Generate a certificate: openssl x509 -req -days 365 -in
something.csr -signkey something.key -out something.crtIOExceptionCopyright © 2012-2013 SURFnet bv, The Netherlands. All Rights Reserved.