Package org.opends.server.util
Class SslUtils
java.lang.Object
org.opends.server.util.SslUtils
Utility class for common SSL related setup.
-
Method Summary
Modifier and TypeMethodDescriptionstatic OptionscreateOptionsForSslContext(Dn trustManagerProviderDn, Dn keyManagerProviderDn, String friendlyName, SortedSet<String> sslCertNicknames, SortedSet<String> sslCipherSuites, SortedSet<String> sslProtocols, ServerContext serverContext, ConnectionSecurity connectionSecurity) Create SSL communicationsOptionsfor an SSL context.static SSLContextcreateSslContext(Collection<Dn> trustManagerProviderDns, Dn keyManagerProviderDn, String friendlyName, SortedSet<String> sslCertNicknames, ServerContext serverContext) Creates an SSL context.static SslOptionscreateSslOptions(Collection<Dn> trustManagerProviderDns, Dn keyManagerProviderDn, String friendlyName, SortedSet<String> sslCertNicknames, SortedSet<String> sslCipherSuites, SortedSet<String> sslProtocols, ServerContext serverContext) CreatesSslOptionsfor the provided parameters.static KeyManager[]getKeyManagers(Dn keyManagerProviderDn, String friendlyName, Set<String> sslCertNicknames, ServerContext serverContext) Returns an array ofKeyManagers for use by theSSLContextwhile setting up communication.static TrustManager[]getTrustManagers(Collection<Dn> trustManagerProviderDns, ServerContext serverContext) Returns an array ofTrustManagers for use by theSSLContextwhile setting up communication.static Collection<LocalizableMessage>verifySslCiphersAndProtocols(Collection<String> cipherSuites, Collection<String> protocols, LocalizableMessageDescriptor.Arg1<Object> cipherError, LocalizableMessageDescriptor.Arg1<Object> protocolError) Verifies all the specified SSL cipher suites and protocols are available in the current JVM.
-
Method Details
-
createOptionsForSslContext
public static Options createOptionsForSslContext(Dn trustManagerProviderDn, Dn keyManagerProviderDn, String friendlyName, SortedSet<String> sslCertNicknames, SortedSet<String> sslCipherSuites, SortedSet<String> sslProtocols, ServerContext serverContext, ConnectionSecurity connectionSecurity) Create SSL communicationsOptionsfor an SSL context.If specific certificate nicknames are specified, only key managers managing those certificates will be returned in
Options.- Parameters:
trustManagerProviderDn- TheDNof the configuration entry providingTrustManagers.keyManagerProviderDn- TheDNof the configuration entry providingKeyManagers.friendlyName- A user readable name to be used in messages.sslCertNicknames- The certificate nicknames to select the key managers to return.sslCipherSuites- Sorted set of strings representing names of the SSL cipher suites which should be used.sslProtocols- Sorted set of strings representing names of the SSL protocols which should be used.serverContext- Theserver contextfrom which the key manager provider will be retrieve.connectionSecurity- Represents the security level of the communications.- Returns:
optionsassociated to the provided SSL context.
-
createSslOptions
public static SslOptions createSslOptions(Collection<Dn> trustManagerProviderDns, Dn keyManagerProviderDn, String friendlyName, SortedSet<String> sslCertNicknames, SortedSet<String> sslCipherSuites, SortedSet<String> sslProtocols, ServerContext serverContext) throws KeyManagementException, LdapException CreatesSslOptionsfor the provided parameters.If specific certificate nicknames are specified, only key managers managing those certificates will be returned in
SslOptions.- Parameters:
trustManagerProviderDns- TheDNs of the configuration entries providingTrustManagers.keyManagerProviderDn- TheDNof the configuration entry providingKeyManagers.friendlyName- A user readable name to be used in messages.sslCertNicknames- The certificate nicknames to select the key managers to return.sslCipherSuites- Sorted set of strings representing names of the SSL cipher suites which should be used.sslProtocols- Sorted set of strings representing names of the SSL protocols which should be used.serverContext- Theserver contextfrom which the key manager provider will be retrieve.- Returns:
SSL optionsassociated to the provided arguments.- Throws:
KeyManagementException- if an error occurred initializing the ssl contextLdapException- If a problem occurs while attempting to obtain the key/trust managers from the provider.
-
createSslContext
public static SSLContext createSslContext(Collection<Dn> trustManagerProviderDns, Dn keyManagerProviderDn, String friendlyName, SortedSet<String> sslCertNicknames, ServerContext serverContext) throws LdapException, KeyManagementException Creates an SSL context.If specific certificate nicknames are specified, only key managers managing those certificates will be used.
- Parameters:
trustManagerProviderDns- TheDNs of the configuration entries providingTrustManagers.keyManagerProviderDn- TheDNof the configuration entry providingKeyManagers.friendlyName- A user readable name to be used in messages.sslCertNicknames- The certificate nicknames to select the key managers to return.serverContext- Theserver contextfrom which the key manager provider will be retrieve.- Returns:
- A new SSL context
- Throws:
LdapException- If a problem occurs while attempting to obtain the key managers from the provider.KeyManagementException- if the SSL context could not be initialized.
-
getKeyManagers
public static KeyManager[] getKeyManagers(Dn keyManagerProviderDn, String friendlyName, Set<String> sslCertNicknames, ServerContext serverContext) throws LdapException Returns an array ofKeyManagers for use by theSSLContextwhile setting up communication.If the keyManagerProviderDn is
nullor if a key manager provider cannot be retrieved from the serverContext, then this method returnsnullwhich means that an empty key manager should be used in communications.- Parameters:
keyManagerProviderDn-DNof the configuration element which represents a key manager provider. Ifnull, the method will useSslOptions.USE_EMPTY_KEY_MANAGER.friendlyName- A user readable name to be used in messages.sslCertNicknames- A set of string representing the aliases of the certificates which will be selected and returned by the method. This parameter can be used to filter out some key managers return by the provider.serverContext- The server context to retrieve the key managers.- Returns:
- The computed
KeyManagers or {code null} if no key manager can be retrieved. - Throws:
LdapException- If a problem occurs while attempting to obtain the key managers from the provider.
-
getTrustManagers
public static TrustManager[] getTrustManagers(Collection<Dn> trustManagerProviderDns, ServerContext serverContext) throws LdapException Returns an array ofTrustManagers for use by theSSLContextwhile setting up communication.- Parameters:
trustManagerProviderDns-DNs of the configuration element which represents trust manager providers.serverContext- The server context to retrieve the trust managers.- Returns:
- The computed
TrustManagers ornullif no trust manager can be retrieved. - Throws:
LdapException- If a problem occurs while attempting to obtain the trust managers from the provider.
-
verifySslCiphersAndProtocols
public static Collection<LocalizableMessage> verifySslCiphersAndProtocols(Collection<String> cipherSuites, Collection<String> protocols, LocalizableMessageDescriptor.Arg1<Object> cipherError, LocalizableMessageDescriptor.Arg1<Object> protocolError) Verifies all the specified SSL cipher suites and protocols are available in the current JVM.- Parameters:
cipherSuites- the list of required SSL cipher suitesprotocols- the list of required SSL protocolcipherError- the error to return for unknown cipher suitesprotocolError- the error to return for unknown protocols- Returns:
- the list of errors to report when one of the cipher suites or protocols are not available
-