Skip to content

Commit 21eb5e3

Browse files
committed
[support] a flag for running SSL support with BC's JSSE provider
1 parent aea89c5 commit 21eb5e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/jruby/ext/openssl/SecurityHelper.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
import org.bouncycastle.operator.OperatorException;
9191
import org.bouncycastle.operator.bc.BcDSAContentVerifierProviderBuilder;
9292
import org.bouncycastle.operator.bc.BcRSAContentVerifierProviderBuilder;
93+
import org.jruby.util.SafePropertyAccessor;
9394

9495
/**
9596
* Java Security (and JCE) helpers.
@@ -663,12 +664,15 @@ static SecretKeyFactory getSecretKeyFactory(final String algorithm, final Provid
663664
);
664665
}
665666

666-
private static boolean providerSSLContext = false; // NOTE: disabled for now due issues
667+
private static final boolean providerSSLContext; // NOTE: experimental support for using BCJSSE
668+
static {
669+
providerSSLContext = SafePropertyAccessor.getBoolean("jruby.openssl.ssl.provider");
670+
}
667671

668672
public static SSLContext getSSLContext(final String protocol)
669673
throws NoSuchAlgorithmException {
670674
try {
671-
if ( providerSSLContext && ! "SSL".equals(protocol) ) { // only TLS versions with BC JSSE
675+
if ( providerSSLContext && ! "SSL".equals(protocol) ) { // only TLS supported in BCJSSE
672676
final Provider provider = getJsseProvider();
673677
if ( provider != null ) {
674678
return getSSLContext(protocol, provider);

0 commit comments

Comments
 (0)