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: ed95b2c7bf85
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: d78fb681ea5c
Choose a head ref
  • 5 commits
  • 7 files changed
  • 1 contributor

Commits on Mar 30, 2016

  1. Copy the full SHA
    7abba65 View commit details
  2. remove unused deprecated method

    kares committed Mar 30, 2016
    Copy the full SHA
    f916d1a View commit details
  3. hide un-used empty class

    kares committed Mar 30, 2016
    Copy the full SHA
    684b850 View commit details
  4. Copy the full SHA
    6a5b3c3 View commit details
  5. Copy the full SHA
    d78fb68 View commit details
29 changes: 19 additions & 10 deletions src/main/java/org/jruby/ext/openssl/x509store/CRL.java
Original file line number Diff line number Diff line change
@@ -36,7 +36,14 @@
*/
public class CRL extends X509Object {

public java.security.cert.CRL crl;
public /* final */ java.security.cert.CRL crl;

@Deprecated // not-used
public CRL() { /* */ }

public CRL(X509CRL crl) {
this.crl = crl;
}

@Override
public int type() {
@@ -45,22 +52,24 @@ public int type() {

@Override
public boolean isName(final Name name) {
return name.equalTo( ((X509CRL) this.crl).getIssuerX500Principal() );
return name.equalTo( ((X509CRL) crl).getIssuerX500Principal() );
}

@Override
public boolean matches(final X509Object other) {
return other instanceof CRL &&
((X509CRL) crl).getIssuerX500Principal().equals( ((X509CRL)((CRL) other).crl).getIssuerX500Principal() );
if (other instanceof CRL) {
final X509CRL thisCRL = (X509CRL) crl;
final X509CRL thatCRL = (X509CRL)((CRL) other).crl;
return thisCRL.getIssuerX500Principal().equals( thatCRL.getIssuerX500Principal() );
}
return false;
}

@Override
public int compareTo(X509Object oth) {
int ret = super.compareTo(oth);
if (ret == 0) {
ret = crl.equals( ((CRL) oth).crl ) ? 0 : -1;
}
return ret;
public int compareTo(final X509Object other) {
int cmp = super.compareTo(other);
if (cmp != 0) return cmp;
return crl.equals( ((CRL) other).crl ) ? 0 : -1;
}

}// X509_OBJECT_CRL
15 changes: 8 additions & 7 deletions src/main/java/org/jruby/ext/openssl/x509store/Certificate.java
Original file line number Diff line number Diff line change
@@ -52,17 +52,18 @@ public boolean isName(final Name name) {

@Override
public boolean matches(final X509Object other) {
return other instanceof Certificate &&
x509.getSubjectX500Principal().equals( ((Certificate) other).x509.getSubjectX500Principal() );
if (other instanceof Certificate) {
final Certificate that = (Certificate) other;
return this.x509.getSubjectX500Principal().equals( that.x509.getSubjectX500Principal() );
}
return false;
}

@Override
public int compareTo(final X509Object other) {
int ret = super.compareTo(other);
if (ret == 0) {
ret = x509.equals( ( (Certificate) other ).x509 ) ? 0 : -1;
}
return ret;
int cmp = super.compareTo(other);
if (cmp != 0) return cmp;
return x509.equals( ( (Certificate) other ).x509 ) ? 0 : -1;
}

}// X509_OBJECT_CERT
5 changes: 0 additions & 5 deletions src/main/java/org/jruby/ext/openssl/x509store/Name.java
Original file line number Diff line number Diff line change
@@ -115,9 +115,4 @@ public boolean equalTo(final X500Principal principal) {
}
}

@Deprecated
public boolean isEqual(final X500Principal principal) {
return equalTo(principal);
}

}// X509_NAME
14 changes: 12 additions & 2 deletions src/main/java/org/jruby/ext/openssl/x509store/PKey.java
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
* rights and limitations under the License.
*
* Copyright (C) 2006 Ola Bini <ola@ologix.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -27,13 +27,23 @@
***** END LICENSE BLOCK *****/
package org.jruby.ext.openssl.x509store;

import java.security.PrivateKey;

/**
* c: X509_OBJECT
*
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
*/
public class PKey extends X509Object {
public java.security.PrivateKey pkey;

public /* final */ java.security.PrivateKey pkey;

@Deprecated // not-used
public PKey() { /* no-op */ }

public PKey(PrivateKey pkey) {
this.pkey = pkey;
}

public int type() {
return X509Utils.X509_LU_PKEY;
Original file line number Diff line number Diff line change
@@ -32,5 +32,6 @@
*
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
*/
public class PolicyTree {
/*public*/ class PolicyTree {
// not-used
}// X509_POLICY_TREE
4 changes: 2 additions & 2 deletions src/main/java/org/jruby/ext/openssl/x509store/Purpose.java
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ public static int getByID(int purpose) {
/**
* c: X509_PURPOSE_add
*/
public static int add(int id, int trust, int flags, CheckPurposeFunction ck, String name, String sname, Object arg) {
static int add(int id, int trust, int flags, CheckPurposeFunction ck, String name, String sname, Object arg) {
flags &= ~X509Utils.X509_PURPOSE_DYNAMIC;
flags |= X509Utils.X509_PURPOSE_DYNAMIC_NAME;
int idx = getByID(id);
@@ -167,7 +167,7 @@ public static int add(int id, int trust, int flags, CheckPurposeFunction ck, Str
ptmp.trust = trust;
ptmp.checkPurpose = ck;
ptmp.userData = arg;
if(idx == -1) {
if (idx == -1) {
xptable.add(ptmp);
}
return 1;
23 changes: 13 additions & 10 deletions src/main/java/org/jruby/ext/openssl/x509store/X509Object.java
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
***** END LICENSE BLOCK *****/
package org.jruby.ext.openssl.x509store;

import java.util.Collection;
import java.util.List;

/**
@@ -35,33 +36,34 @@
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
*/
public abstract class X509Object implements Comparable<X509Object> {

/**
* c: X509_OBJECT_idx_by_subject
*/
public static int indexBySubject(List<? extends X509Object> h, int type, Name name) {
int ix = 0;
for ( X509Object oo : h ) {
if ( type == oo.type() && oo.isName(name) ) return ix;
public static int indexBySubject(final List<? extends X509Object> list, int type, Name name) {
for ( int i = 0; i < list.size(); i++ ) {
final X509Object obj = list.get(i);
if ( type == obj.type() && obj.isName(name) ) return i;
}
return -1;
}

/**
* c: X509_OBJECT_retrieve_by_subject
*/
public static X509Object retrieveBySubject(final List<? extends X509Object> h, int type, Name name) {
for ( X509Object o : h ) {
if ( type == o.type() && o.isName(name) ) return o;
public static X509Object retrieveBySubject(final Collection<? extends X509Object> list, int type, Name name) {
for ( X509Object obj : list ) {
if ( type == obj.type() && obj.isName(name) ) return obj;
}
return null;
}

/**
* c: X509_OBJECT_retrieve_match
*/
public static X509Object retrieveMatch(final List<? extends X509Object> h, X509Object x) {
for ( X509Object o : h ) {
if ( o.matches(x) ) return o;
public static X509Object retrieveMatch(final Collection<? extends X509Object> list, X509Object x) {
for ( X509Object obj : list ) {
if ( obj.matches(x) ) return obj;
}
return null;
}
@@ -79,4 +81,5 @@ public boolean matches(X509Object o) {
public int compareTo(X509Object other) {
return type() - other.type();
}

}// X509_OBJECT