nodece commented on a change in pull request #13740:
URL: https://github.com/apache/pulsar/pull/13740#discussion_r820470253
##########
File path:
pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java
##########
@@ -300,27 +310,65 @@ public static SslContext
createNettySslContextForServer(boolean allowInsecureCon
}
public static SSLContext createSslContext(boolean allowInsecureConnection,
Certificate[] trustCertficates,
- Certificate[] certificates, PrivateKey privateKey) throws
GeneralSecurityException {
+ Certificate[] certificates,
PrivateKey privateKey)
+ throws GeneralSecurityException {
+ return createSslContext(allowInsecureConnection, trustCertficates,
certificates, privateKey, null);
+ }
+
+ public static SSLContext createSslContext(boolean allowInsecureConnection,
Certificate[] trustCertficates,
+ Certificate[] certificates,
PrivateKey privateKey, String providerName)
+ throws GeneralSecurityException {
KeyStoreHolder ksh = new KeyStoreHolder();
TrustManager[] trustManagers = null;
KeyManager[] keyManagers = null;
+ Provider provider = null;
+ if (providerName != null && !providerName.equals("")) {
+ if (providerName.equalsIgnoreCase(CONSCRYPT_PROVIDER_NAME)) {
Review comment:
Fixed.
##########
File path:
pulsar-common/src/main/java/org/apache/pulsar/common/util/SecurityUtility.java
##########
@@ -300,27 +310,65 @@ public static SslContext
createNettySslContextForServer(boolean allowInsecureCon
}
public static SSLContext createSslContext(boolean allowInsecureConnection,
Certificate[] trustCertficates,
- Certificate[] certificates, PrivateKey privateKey) throws
GeneralSecurityException {
+ Certificate[] certificates,
PrivateKey privateKey)
+ throws GeneralSecurityException {
+ return createSslContext(allowInsecureConnection, trustCertficates,
certificates, privateKey, null);
+ }
+
+ public static SSLContext createSslContext(boolean allowInsecureConnection,
Certificate[] trustCertficates,
+ Certificate[] certificates,
PrivateKey privateKey, String providerName)
+ throws GeneralSecurityException {
KeyStoreHolder ksh = new KeyStoreHolder();
TrustManager[] trustManagers = null;
KeyManager[] keyManagers = null;
+ Provider provider = null;
+ if (providerName != null && !providerName.equals("")) {
+ if (providerName.equalsIgnoreCase(CONSCRYPT_PROVIDER_NAME)) {
+ provider = CONSCRYPT_PROVIDER;
+ } else {
+ provider = Security.getProvider(providerName);
+ if (provider == null) {
+ log.warn("Cannot to get {} security provider, fallback to
using JDK default security provider",
+ providerName);
+ provider = SSLContext.getDefault().getProvider();
+ }
+ }
Review comment:
Fixed.
##########
File path:
pulsar-common/src/main/java/org/apache/pulsar/common/util/jetty/JettySslContextFactory.java
##########
@@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.common.util.jetty;
+
+import java.util.Set;
+import javax.net.ssl.SSLContext;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.pulsar.common.util.DefaultSslContextBuilder;
+import org.apache.pulsar.common.util.SslContextAutoRefreshBuilder;
+import org.apache.pulsar.common.util.keystoretls.NetSslContextBuilder;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+
+@Slf4j
+public class JettySslContextFactory {
Review comment:
Fixed.
##########
File path:
pulsar-common/src/main/java/org/apache/pulsar/common/util/jetty/package-info.java
##########
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.common.util.jetty;
Review comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]