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

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

Introduction

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

Prototype

public ASN1GeneralizedTime getRevocationTime() 

Source Link

Usage

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

License:Common Public License

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