public class Certs
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CIPHER |
Constructor and Description |
---|
Certs()
Create a new Certs.
|
Modifier and Type | Method and Description |
---|---|
Certs |
addClusterCertificate(java.lang.String alias,
byte[] cert)
Helper in case the cluster certificate is already loaded is a byte[]
|
Certs |
addClusterCertificate(java.lang.String alias,
java.io.InputStream is)
Loads a single X.509 certificate from the provided InputStream into the current KeyStore.
|
Certs |
parseClientPEM(java.io.Reader reader)
Parse the contents of the provided Reader for an X.509 Certificate with public key, and a PEM
Key Pair, and calls setClientCertificateHolder and setClientKeyPair as appropriate.
|
Certs |
setClientCertificateHolder(org.bouncycastle.cert.X509CertificateHolder certHolder)
Set the ClientCertificateHolder.
|
Certs |
setClientKeyPair(org.bouncycastle.openssl.PEMKeyPair keyPair)
Set the ClientKeyPair.
|
Certs |
setKeyStore(java.security.KeyStore ks)
Provided in case you wish to provide your own keystore (for example one that is stored on
disk rather than an ephemeral one).
|
public static final java.lang.String CIPHER
public Certs() throws java.security.NoSuchProviderException, java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
- if BouncyCastle can't be foundjava.security.NoSuchAlgorithmException
- if ECDSA support can't be foundpublic Certs setKeyStore(java.security.KeyStore ks)
ks
- The KeyStore to use.public Certs addClusterCertificate(java.lang.String alias, java.io.InputStream is) throws java.security.cert.CertificateException, java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.io.IOException
alias
- The name under which to store the certificate (just pick something sane)is
- The InputStream to read the certificate from.java.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.io.IOException
public Certs addClusterCertificate(java.lang.String alias, byte[] cert) throws java.security.cert.CertificateException, java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.io.IOException
alias
- The name under which to store the certificate (just pick something sane)cert
- The bytes of the certificatejava.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.io.IOException
public Certs setClientCertificateHolder(org.bouncycastle.cert.X509CertificateHolder certHolder) throws java.security.cert.CertificateException, java.security.spec.InvalidKeySpecException, java.security.InvalidKeyException, java.io.IOException
certHolder
- The holder for the client certificate and public keyjava.security.cert.CertificateException
java.security.spec.InvalidKeySpecException
java.security.InvalidKeyException
java.io.IOException
public Certs setClientKeyPair(org.bouncycastle.openssl.PEMKeyPair keyPair) throws java.security.cert.CertificateException, java.security.spec.InvalidKeySpecException, java.security.InvalidKeyException, java.io.IOException
keyPair
- The client public and private key pairjava.security.cert.CertificateException
java.security.spec.InvalidKeySpecException
java.security.InvalidKeyException
java.io.IOException
public Certs parseClientPEM(java.io.Reader reader) throws java.security.cert.CertificateException, java.security.spec.InvalidKeySpecException, java.security.InvalidKeyException, java.io.IOException
reader
- The reader to read fromjava.security.cert.CertificateException
java.security.spec.InvalidKeySpecException
java.security.InvalidKeyException
java.io.IOException