Example usage for org.bouncycastle.asn1.ocsp CertID getHashAlgorithm

List of usage examples for org.bouncycastle.asn1.ocsp CertID getHashAlgorithm

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.ocsp CertID getHashAlgorithm.

Prototype

public AlgorithmIdentifier getHashAlgorithm() 

Source Link

Usage

From source file:org.jruby.ext.openssl.OCSPCertificateId.java

License:Common Public License

@JRubyMethod(name = "cmp_issuer")
public IRubyObject cmp_issuer(IRubyObject other) {
    Ruby runtime = getRuntime();/*from www.j  av  a 2  s . c  o  m*/
    if (equals(other)) {
        return RubyFixnum.zero(runtime);
    }
    if (other instanceof OCSPCertificateId) {
        OCSPCertificateId that = (OCSPCertificateId) other;
        CertID thisCert = this.getCertID();
        CertID thatCert = that.getCertID();
        int ret = thisCert.getHashAlgorithm().getAlgorithm().toString()
                .compareTo(thatCert.getHashAlgorithm().getAlgorithm().toString());
        if (ret != 0)
            return RubyFixnum.newFixnum(runtime, ret);
        ret = thisCert.getIssuerNameHash().toString().compareTo(thatCert.getIssuerNameHash().toString());
        if (ret != 0)
            return RubyFixnum.newFixnum(runtime, ret);
        return RubyFixnum.newFixnum(runtime,
                thisCert.getIssuerKeyHash().toString().compareTo(thatCert.getIssuerKeyHash().toString()));
    } else {
        return runtime.getCurrentContext().nil;
    }
}