public class CertificateManagement extends Object
SecurityContext
.
This class assumes the keystore holds only the server certificate with its
private key and its full chain, the truststore holds the set of all
trusted certificates, and all stores are of type "JKS".Constructor and Description |
---|
CertificateManagement(SecurityContext context)
Creates a CertificateManagement library for the security context.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteTrustedCertificate(String alias)
Removes the certificate with the specified alias from the truststore.
|
List<X509Certificate> |
getServerCertificates()
Get the server certificate chain from the keystore.
|
X509Certificate |
getTrustedCertificate(String alias)
Get a certificate from the truststore.
|
void |
installTrustedCertificate(String alias,
X509Certificate certificate)
Install the certificate into the truststore with the specified alias.
|
public CertificateManagement(SecurityContext context)
context
- the security contextNullPointerException
- if null SecurityContextpublic void installTrustedCertificate(String alias, X509Certificate certificate) throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException
alias
- the alias the certificateIOException
- if file access failureKeyStoreException
- if generic KeyStore errorCertificateException
- if certificate errorNoSuchAlgorithmException
- if invalid KeyStore formatIllegalArgumentException
- if invalid parameterpublic X509Certificate getTrustedCertificate(String alias) throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException
IOException
- if file access failureKeyStoreException
- if generic KeyStore errorCertificateException
- if certificate errorNoSuchAlgorithmException
- if invalid KeyStore formatIllegalArgumentException
- if invalid parameterpublic void deleteTrustedCertificate(String alias) throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException
alias
- the certificate aliasIOException
- if file access failureKeyStoreException
- if generic KeyStore errorCertificateException
- if certificate errorNoSuchAlgorithmException
- if invalid KeyStore formatIllegalArgumentException
- if invalid parameterpublic List<X509Certificate> getServerCertificates() throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException
IOException
- if file access failureKeyStoreException
- if generic KeyStore errorCertificateException
- if certificate errorNoSuchAlgorithmException
- if invalid KeyStore formatCopyright © 2015. All Rights Reserved.