public abstract class CommonConfigurationImpl extends Object implements CommonConfiguration
| Modifier and Type | Field and Description |
|---|---|
protected String |
entityId |
protected KeyStore |
keyStore |
protected String |
keystorePassword |
protected Map<String,String> |
privateKeyPasswords |
| Constructor and Description |
|---|
CommonConfigurationImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendToKeyStore(KeyStore keyStore,
String keyAlias,
String certificateFile,
String privatekeyFile,
char[] password)
Append a certificate and private key to a keystore.
|
String |
getEntityID() |
KeyStore |
getKeyStore() |
Map<String,String> |
getPrivateKeyPasswords() |
void |
injectCredential(String certificate,
String key) |
void |
setEntityID(String newEntityId) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitresetprotected KeyStore keyStore
protected String keystorePassword
protected String entityId
public Map<String,String> getPrivateKeyPasswords()
getPrivateKeyPasswords in interface CommonConfigurationpublic KeyStore getKeyStore()
getKeyStore in interface CommonConfigurationpublic String getEntityID()
getEntityID in interface CommonConfigurationpublic void setEntityID(String newEntityId)
setEntityID in interface CommonConfigurationpublic void injectCredential(String certificate, String key)
injectCredential in interface CommonConfigurationprotected void appendToKeyStore(KeyStore keyStore, String keyAlias, String certificateFile, String privatekeyFile, char[] password) throws Exception
keyStore - where to append the certificate and private key tokeyAlias - the alias of the keycertificateFile - the file containing the certificate in the PEM formatprivatekeyFile - the file 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.crtExceptionCopyright © 2012. All Rights Reserved.