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

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

Introduction

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

Prototype

public static RevokedInfo getInstance(Object obj) 

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();/*from www .  j a v a 2 s  .  com*/
    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();
}

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

License:Common Public License

@JRubyMethod(name = "revocation_time")
public IRubyObject revocation_time() {
    Ruby runtime = getRuntime();//from   ww  w .j  a v a  2 s  .  co  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 RubyTime.newTime(runtime, revokedInfo.getRevocationTime().getDate().getTime());
        } catch (Exception e) {
            throw newOCSPError(runtime, e);
        }
    }
    return runtime.getNil();
}