| | |
| | | import javax.net.ssl.KeyManager; |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.TrustManager; |
| | | import javax.net.ssl.X509ExtendedKeyManager; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | // TODO: Move the following configuration to replication configuration. |
| | | // TODO: https://opends.dev.java.net/issues/show_bug.cgi?id=2473 |
| | | |
| | | /** The name of the local certificate to use for SSL. */ |
| | | private final String sslCertNickname; |
| | | /** The names of the local certificates to use for SSL. */ |
| | | private final SortedSet<String> sslCertNicknames; |
| | | |
| | | /** Whether replication sessions use SSL encryption. */ |
| | | private final boolean sslEncryption; |
| | |
| | | applyConfigurationChange(config); |
| | | |
| | | // Secure replication related... |
| | | sslCertNickname = config.getSSLCertNickname(); |
| | | sslCertNicknames = config.getSSLCertNickname(); |
| | | sslEncryption = config.isSSLEncryption(); |
| | | sslProtocols = config.getSSLProtocol(); |
| | | sslCipherSuites = config.getSSLCipherSuite(); |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SSLContext getSslContext(String sslCertNickname) |
| | | public SSLContext getSslContext(SortedSet<String> sslCertNicknames) |
| | | throws ConfigException |
| | | { |
| | | SSLContext sslContext; |
| | |
| | | |
| | | sslContext = SSLContext.getInstance("TLS"); |
| | | |
| | | if (sslCertNickname == null) |
| | | if (sslCertNicknames == null) |
| | | { |
| | | sslContext.init(keyManagers, trustManagers, null); |
| | | } |
| | | else |
| | | { |
| | | X509ExtendedKeyManager[] extendedKeyManagers = |
| | | KeyManager[] extendedKeyManagers = |
| | | SelectableCertificateKeyManager.wrap( |
| | | keyManagers, |
| | | sslCertNickname); |
| | | sslCertNicknames); |
| | | sslContext.init(extendedKeyManagers, trustManagers, null); |
| | | } |
| | | } |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getSslCertNickname() |
| | | public SortedSet<String> getSslCertNicknames() |
| | | { |
| | | return sslCertNickname; |
| | | return sslCertNicknames; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |