nl.surfnet.spring.security.opensaml.util
Class KeyStoreUtil
java.lang.Object
nl.surfnet.spring.security.opensaml.util.KeyStoreUtil
public class KeyStoreUtil
- extends Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KeyStoreUtil
public KeyStoreUtil()
appendKeyToKeyStore
public static void appendKeyToKeyStore(KeyStore keyStore,
String keyAlias,
InputStream certificateInputStream,
InputStream privatekeyInputStream,
char[] password)
throws IOException
- Append a certificate and private key to a keystore.
- Parameters:
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.crt
- Throws:
IOException
appendCertificateToKeyStore
public static void appendCertificateToKeyStore(KeyStore keyStore,
String keyAlias,
String pemCert)
- Append a certificate to the given key store
- Parameters:
keyStore - keyAlias - pemCert -
Copyright © 2012 SURFnet bv, The Netherlands. All Rights Reserved.