Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/org/jruby/ext/openssl/OpenSSL.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.ByteList;
import org.jruby.util.SafePropertyAccessor;

/**
* OpenSSL (methods as well as an entry point)
Expand All @@ -55,7 +56,7 @@ public static boolean isProviderAvailable() {
}

public static void createOpenSSL(final Ruby runtime) {
boolean registerProvider = Boolean.getBoolean("jruby.openssl.provider.register");
boolean registerProvider = SafePropertyAccessor.getBoolean("jruby.openssl.provider.register");
SecurityHelper.setRegisterProvider( registerProvider );

final RubyModule _OpenSSL = runtime.getOrCreateModule("OpenSSL");
Expand Down Expand Up @@ -109,9 +110,9 @@ public static void createOpenSSL(final Ruby runtime) {
_OpenSSL.setConstant("OPENSSL_VERSION", runtime.newString(OPENSSL_VERSION));
_OpenSSL.setConstant("OPENSSL_VERSION_NUMBER", runtime.newFixnum(OPENSSL_VERSION_NUMBER));

setDebug(_OpenSSL, runtime.newBoolean( Boolean.getBoolean("jruby.openssl.debug") ) );
setDebug(_OpenSSL, runtime.newBoolean( SafePropertyAccessor.getBoolean("jruby.openssl.debug") ) );

final String warn = System.getProperty("jruby.openssl.warn");
final String warn = SafePropertyAccessor.getProperty("jruby.openssl.warn");
if ( warn != null ) OpenSSL.warn = Boolean.parseBoolean(warn);
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/jruby/ext/openssl/x509store/Lookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.jruby.RubyHash;
import org.jruby.ext.openssl.SecurityHelper;
import org.jruby.util.JRubyFile;
import org.jruby.util.SafePropertyAccessor;
import org.jruby.util.io.ChannelDescriptor;
import org.jruby.util.io.ChannelStream;
import org.jruby.util.io.FileExistsException;
Expand Down Expand Up @@ -277,7 +278,7 @@ else if ( v instanceof CRL ) {
}

public int loadDefaultJavaCACertsFile() throws Exception {
final String certsFile = System.getProperty("java.home") +
final String certsFile = SafePropertyAccessor.getProperty("java.home") +
"/lib/security/cacerts".replace('/', File.separatorChar);
final FileInputStream fin = new FileInputStream(certsFile);
int count = 0;
Expand Down Expand Up @@ -543,7 +544,7 @@ private int addCertificateDirectory(final LookupDir ctx, final String dir, final
return 0;
}

String[] dirs = dir.split(System.getProperty("path.separator"));
String[] dirs = dir.split(SafePropertyAccessor.getProperty("path.separator"));

for ( int i=0; i<dirs.length; i++ ) {
if ( dirs[i].length() == 0 ) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/jruby/ext/openssl/x509store/X509Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
import org.bouncycastle.asn1.x509.SubjectKeyIdentifier;
import org.bouncycastle.asn1.x500.X500Name;

import org.jruby.util.SafePropertyAccessor;

/**
* Contains most of the functionality that beings with X509 in
* crypty/x509/x509_def.c, crypty/x509/x509_txt.c and others.
Expand Down Expand Up @@ -284,9 +286,9 @@ else if ( keyUsage != null && ! keyUsage[5] ) { // KU_KEY_CERT_SIGN

public static final String OPENSSLDIR = "/usr/local/openssl";

public static final String X509_CERT_AREA = System.getProperty("java.home") + "/lib/security";
public static final String X509_CERT_DIR = System.getProperty("java.home") + "/lib/security";
public static final String X509_CERT_FILE = System.getProperty("java.home") + "/lib/security" + "/cacerts";
public static final String X509_CERT_AREA = SafePropertyAccessor.getProperty("java.home") + "/lib/security";
public static final String X509_CERT_DIR = SafePropertyAccessor.getProperty("java.home") + "/lib/security";
public static final String X509_CERT_FILE = SafePropertyAccessor.getProperty("java.home") + "/lib/security" + "/cacerts";
public static final String X509_PRIVATE_DIR = "/usr/lib/ssl/private";

public static final String X509_CERT_DIR_EVP = "SSL_CERT_DIR";
Expand Down