Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby-openssl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1b5dbbe51f58
Choose a base ref
...
head repository: jruby/jruby-openssl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1d3ba21fbe2f
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Aug 19, 2015

  1. the default cert could be PEM or a java keystore. it should load both…

    … whatver is used as default.
    mkristian committed Aug 19, 2015
    9
    Copy the full SHA
    1d3ba21 View commit details
Showing with 24 additions and 2 deletions.
  1. +1 −1 lib/jopenssl/version.rb
  2. +1 −1 src/main/java/org/jruby/ext/openssl/OpenSSL.java
  3. +22 −0 src/main/java/org/jruby/ext/openssl/x509store/Lookup.java
2 changes: 1 addition & 1 deletion lib/jopenssl/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Jopenssl
module Version
VERSION = '0.9.9'
VERSION = '0.9.10'
BOUNCY_CASTLE_VERSION = '1.50'
end
end
2 changes: 1 addition & 1 deletion src/main/java/org/jruby/ext/openssl/OpenSSL.java
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ static boolean isDebug(final Ruby runtime) {
return getDebug( OpenSSL ) == runtime.getTrue();
}

static void debugStackTrace(final Ruby runtime, final Throwable e) {
public static void debugStackTrace(final Ruby runtime, final Throwable e) {
if ( isDebug(runtime) ) e.printStackTrace(runtime.getOut());
}

22 changes: 22 additions & 0 deletions src/main/java/org/jruby/ext/openssl/x509store/Lookup.java
Original file line number Diff line number Diff line change
@@ -27,6 +27,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ext.openssl.x509store;


import static org.jruby.ext.openssl.OpenSSL.debugStackTrace;

import org.jruby.ext.openssl.util.Cache;
import static org.jruby.ext.openssl.x509store.X509Utils.X509_CERT_DIR;
import static org.jruby.ext.openssl.x509store.X509Utils.X509_FILETYPE_ASN1;
@@ -239,6 +242,10 @@ else if ( type == X509_FILETYPE_ASN1 ) {
return 0; // NOTE: really?
}
}
catch(IOException e) {
debugStackTrace(runtime, e);
return 0;
}
finally {
if ( reader != null ) {
try { reader.close(); } catch (Exception ignored) {}
@@ -285,6 +292,10 @@ else if ( type == X509_FILETYPE_ASN1 ) {
return 0; // NOTE: really?
}
}
catch(IOException e) {
debugStackTrace(runtime, e);
return 0;
}
finally {
if ( reader != null ) {
try { reader.close(); } catch (Exception ignored) {}
@@ -345,6 +356,10 @@ else if ( cert instanceof CRL ) {
}
return count;
}
catch(IOException e) {
debugStackTrace(runtime, e);
return 0;
}
finally {
if ( reader != null ) {
try { reader.close(); } catch (Exception ignored) {}
@@ -367,6 +382,9 @@ public int loadDefaultJavaCACertsFile() throws IOException, GeneralSecurityExcep
count++;
}
}
catch(IOException e) {
return 0;
}
finally {
try { fin.close(); } catch (Exception ignored) {}
}
@@ -522,6 +540,10 @@ public int call(final Lookup ctx, final Integer cmd, final String argp, final Nu
ok = ctx.loadCertificateOrCRLFile(file, X509_FILETYPE_PEM) != 0 ? 1 : 0;
} else {
ok = (ctx.loadDefaultJavaCACertsFile() != 0) ? 1: 0;
// it could be a PEM file
if (ok == 0) {
ok = ctx.loadCertificateOrCRLFile(file, X509_FILETYPE_PEM) != 0 ? 1 : 0;
}
}
if (ok == 0) {
X509Error.addError(X509_R_LOADING_DEFAULTS);