public interface SecurityProviderTool
| Modifier and Type | Method and Description |
|---|---|
CertificateAndKey |
createCARootCertificate(CertificateInfo certificateInfo,
java.security.KeyPair keyPair,
java.lang.String messageDigest)
Creates a new self-signed CA root certificate, suitable for use signing new server certificates.
|
java.security.KeyStore |
createRootCertificateKeyStore(java.lang.String keyStoreType,
CertificateAndKey rootCertificateAndKey,
java.lang.String privateKeyAlias,
java.lang.String password)
Assembles a Java KeyStore containing a CA root certificate and its private key.
|
CertificateAndKey |
createServerCertificate(CertificateInfo certificateInfo,
java.security.cert.X509Certificate caRootCertificate,
java.security.PrivateKey caPrivateKey,
java.security.KeyPair serverKeyPair,
java.lang.String messageDigest)
Creates a new server X.509 certificate using the serverKeyPair.
|
java.security.KeyStore |
createServerKeyStore(java.lang.String keyStoreType,
CertificateAndKey serverCertificateAndKey,
java.security.cert.X509Certificate rootCertificate,
java.lang.String privateKeyAlias,
java.lang.String password)
Assembles a Java KeyStore containing a server's certificate, private key, and the certificate authority's certificate,
which can be used to create an
SSLContext. |
java.security.cert.X509Certificate |
decodePemEncodedCertificate(java.io.Reader certificateReader)
Decodes a PEM-encoded X.509 Certificate into a
X509Certificate. |
java.security.PrivateKey |
decodePemEncodedPrivateKey(java.io.Reader privateKeyReader,
java.lang.String password)
Decodes a PEM-encoded private key into a
PrivateKey. |
java.lang.String |
encodeCertificateAsPem(java.security.cert.Certificate certificate)
Encodes a certificate in PEM format.
|
java.lang.String |
encodePrivateKeyAsPem(java.security.PrivateKey privateKey,
java.lang.String passwordForPrivateKey,
java.lang.String encryptionAlgorithm)
Encodes a private key in PEM format, encrypting it with the specified password.
|
javax.net.ssl.KeyManager[] |
getKeyManagers(java.security.KeyStore keyStore,
java.lang.String keyStorePassword)
Retrieve the KeyManagers for the specified KeyStore.
|
java.security.KeyStore |
loadKeyStore(java.io.File file,
java.lang.String keyStoreType,
java.lang.String password)
Loads a Java KeyStore object from a file.
|
void |
saveKeyStore(java.io.File file,
java.security.KeyStore keyStore,
java.lang.String keystorePassword)
Saves a Java KeyStore to a file, protecting it with the specified password.
|
CertificateAndKey createCARootCertificate(CertificateInfo certificateInfo, java.security.KeyPair keyPair, java.lang.String messageDigest)
certificateInfo - certificate info to populate in the new root certkeyPair - root certificate's public and private keysmessageDigest - digest to use when signing the new root certificate, such as SHA512CertificateAndKey createServerCertificate(CertificateInfo certificateInfo, java.security.cert.X509Certificate caRootCertificate, java.security.PrivateKey caPrivateKey, java.security.KeyPair serverKeyPair, java.lang.String messageDigest)
certificateInfo - basic X.509 certificate info that will be used to create the server certificatecaRootCertificate - root certificate that will be used to populate the issuer field of the server certificateserverKeyPair - server's public and private keysmessageDigest - message digest to use when signing the server certificate, such as SHA512caPrivateKey - root certificate private key that will be used to sign the server certificatejava.security.KeyStore createServerKeyStore(java.lang.String keyStoreType,
CertificateAndKey serverCertificateAndKey,
java.security.cert.X509Certificate rootCertificate,
java.lang.String privateKeyAlias,
java.lang.String password)
SSLContext.keyStoreType - the KeyStore type, such as JKS or PKCS12serverCertificateAndKey - certificate and private key for the server, which will be placed in the KeyStorerootCertificate - CA root certificate of the private key that signed the server certificateprivateKeyAlias - alias to assign the private key (with accompanying certificate chain) to in the KeyStorepassword - password for the new KeyStore and private keyjava.security.KeyStore createRootCertificateKeyStore(java.lang.String keyStoreType,
CertificateAndKey rootCertificateAndKey,
java.lang.String privateKeyAlias,
java.lang.String password)
keyStoreType - the KeyStore type, such as JKS or PKCS12rootCertificateAndKey - certification authority's root certificate and private key, which will be placed in the KeyStoreprivateKeyAlias - alias to assign the private key (with accompanying certificate chain) to in the KeyStorepassword - password for the new KeyStore and private keyjava.lang.String encodePrivateKeyAsPem(java.security.PrivateKey privateKey,
java.lang.String passwordForPrivateKey,
java.lang.String encryptionAlgorithm)
privateKey - private key to encodepasswordForPrivateKey - password to protect the private keyencryptionAlgorithm - algorithm to use to encrypt the private keyjava.lang.String encodeCertificateAsPem(java.security.cert.Certificate certificate)
certificate - certificate to encodejava.security.PrivateKey decodePemEncodedPrivateKey(java.io.Reader privateKeyReader,
java.lang.String password)
PrivateKey. The password may be null if the PEM-encoded private key
is not password-encrypted.privateKeyReader - a reader for a PEM-encoded private keypassword - password protecting the private key @return the decoded private keyjava.security.cert.X509Certificate decodePemEncodedCertificate(java.io.Reader certificateReader)
X509Certificate.certificateReader - a reader for a PEM-encoded certificatejava.security.KeyStore loadKeyStore(java.io.File file,
java.lang.String keyStoreType,
java.lang.String password)
file - KeyStore file to loadkeyStoreType - KeyStore type (PKCS12, JKS, etc.)password - the KeyStore passwordvoid saveKeyStore(java.io.File file,
java.security.KeyStore keyStore,
java.lang.String keystorePassword)
file - file to save the KeyStore tokeyStore - KeyStore to savekeystorePassword - password for the KeyStorejavax.net.ssl.KeyManager[] getKeyManagers(java.security.KeyStore keyStore,
java.lang.String keyStorePassword)
keyStore - the KeyStore to retrieve KeyManagers fromkeyStorePassword - the KeyStore password