Example usage for org.bouncycastle.asn1.ocsp RevokedInfo getRevocationReason

List of usage examples for org.bouncycastle.asn1.ocsp RevokedInfo getRevocationReason

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.ocsp RevokedInfo getRevocationReason.

Prototype

public CRLReason getRevocationReason() 

Source Link

Usage

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

License:Common Public License

@JRubyMethod(name = "revocation_reason")
public IRubyObject revocation_reason() {
    Ruby runtime = getRuntime();// w ww .  j  a v a2s  .c o  m
    RubyFixnum revoked = (RubyFixnum) _OCSP(runtime).getConstant("V_CERTSTATUS_REVOKED");
    if (bcSingleResponse.getCertStatus().getTagNo() == (int) revoked.getLongValue()) {
        try {
            RevokedInfo revokedInfo = RevokedInfo.getInstance(DERTaggedObject.fromByteArray(
                    bcSingleResponse.getCertStatus().getStatus().toASN1Primitive().getEncoded()));
            return RubyFixnum.newFixnum(runtime, revokedInfo.getRevocationReason().getValue().intValue());
        } catch (IOException e) {
            throw newOCSPError(runtime, e);
        }
    }
    return runtime.getNil();
}