Package org.ldaptive.ssl
Class X509SSLContextInitializer
java.lang.Object
org.ldaptive.ssl.AbstractSSLContextInitializer
org.ldaptive.ssl.X509SSLContextInitializer
- All Implemented Interfaces:
SSLContextInitializer
Provides an SSL context initializer which can use X.509 certificates to create key and trust managers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate X509CertificateCertificate used to create key managers.private PrivateKeyPrivate key used to create key managers.private X509Certificate[]Certificates used to create trust managers.Fields inherited from class org.ldaptive.ssl.AbstractSSLContextInitializer
logger, trustManagers -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TrustManager[]Creates any trust managers specific to this context initializer.Returns the certificate to use for creating the key managers.Returns the private key associated with the authentication certificate.protected KeyManagerFactorygetKeyManagerFactory(X509Certificate cert, PrivateKey key) Creates a new key manager factory.Returns the key managers used when creating SSL contexts.Returns the certificates to use for creating the trust managers.protected TrustManagerFactorygetTrustManagerFactory(X509Certificate[] certs) Creates a new trust manager factory.voidSets the certificate to use for creating the key managers.voidSets the private key associated with the authentication certificate.voidsetTrustCertificates(X509Certificate... certs) Sets the certificates to use for creating the trust managers.toString()Methods inherited from class org.ldaptive.ssl.AbstractSSLContextInitializer
aggregateTrustManagers, getTrustManagers, initSSLContext, setTrustManagers
-
Field Details
-
trustCerts
Certificates used to create trust managers. -
authenticationCert
Certificate used to create key managers. -
authenticationKey
Private key used to create key managers.
-
-
Constructor Details
-
X509SSLContextInitializer
public X509SSLContextInitializer()
-
-
Method Details
-
getTrustCertificates
Returns the certificates to use for creating the trust managers.- Returns:
- X.509 certificates
-
setTrustCertificates
Sets the certificates to use for creating the trust managers.- Parameters:
certs- X.509 certificates
-
getAuthenticationCertificate
Returns the certificate to use for creating the key managers.- Returns:
- X.509 certificate
-
setAuthenticationCertificate
Sets the certificate to use for creating the key managers.- Parameters:
cert- X.509 certificate
-
getAuthenticationKey
Returns the private key associated with the authentication certificate.- Returns:
- private key
-
setAuthenticationKey
Sets the private key associated with the authentication certificate.- Parameters:
key- private key
-
createTrustManagers
Description copied from class:AbstractSSLContextInitializerCreates any trust managers specific to this context initializer.- Specified by:
createTrustManagersin classAbstractSSLContextInitializer- Returns:
- trust managers
- Throws:
GeneralSecurityException- if an errors occurs while loading the TrustManagers
-
getTrustManagerFactory
protected TrustManagerFactory getTrustManagerFactory(X509Certificate[] certs) throws GeneralSecurityException Creates a new trust manager factory.- Parameters:
certs- to add as trusted material- Returns:
- trust manager factory
- Throws:
GeneralSecurityException- if the trust manager factory cannot be initialized
-
getKeyManagers
Description copied from interface:SSLContextInitializerReturns the key managers used when creating SSL contexts.- Returns:
- key managers
- Throws:
GeneralSecurityException- if an errors occurs while loading the KeyManagers
-
getKeyManagerFactory
protected KeyManagerFactory getKeyManagerFactory(X509Certificate cert, PrivateKey key) throws GeneralSecurityException Creates a new key manager factory.- Parameters:
cert- to initialize the key manager factorykey- to initialize the key manager factory- Returns:
- key manager factory
- Throws:
GeneralSecurityException- if the key manager factory cannot be initialized
-
toString
-