use of org.bouncycastle.asn1.ASN1GeneralizedTime in project jruby-openssl by jruby.
the class OCSPSingleResponse method check_validity.
@JRubyMethod(name = "check_validity", rest = true)
public IRubyObject check_validity(IRubyObject[] args) {
Ruby runtime = getRuntime();
int nsec, maxsec;
Date thisUpdate, nextUpdate;
if (Arity.checkArgumentCount(runtime, args, 0, 2) == 0) {
nsec = 0;
maxsec = -1;
} else if (Arity.checkArgumentCount(runtime, args, 0, 2) == 1) {
RubyFixnum rNsec = (RubyFixnum) args[0];
nsec = (int) rNsec.getLongValue();
maxsec = -1;
} else {
RubyFixnum rNsec = (RubyFixnum) args[0];
RubyFixnum rMaxsec = (RubyFixnum) args[1];
nsec = (int) rNsec.getLongValue();
maxsec = (int) rMaxsec.getLongValue();
}
try {
ASN1GeneralizedTime bcThisUpdate = bcSingleResponse.getThisUpdate();
if (bcThisUpdate == null) {
thisUpdate = null;
} else {
thisUpdate = bcThisUpdate.getDate();
}
ASN1GeneralizedTime bcNextUpdate = bcSingleResponse.getNextUpdate();
if (bcNextUpdate == null) {
nextUpdate = null;
} else {
nextUpdate = bcNextUpdate.getDate();
}
} catch (ParseException e) {
throw newOCSPError(runtime, e);
}
return RubyBoolean.newBoolean(runtime, checkValidityImpl(thisUpdate, nextUpdate, nsec, maxsec));
}
Aggregations