List of usage examples for org.bouncycastle.asn1.x509 Time getInstance
public static Time getInstance(ASN1TaggedObject obj, boolean explicit)
From source file:com.novosec.pkix.asn1.crmf.OptionalValidity.java
License:Open Source License
public OptionalValidity(ASN1Sequence seq) { Enumeration e = (seq == null ? null : seq.getObjects()); while (e != null && e.hasMoreElements()) { DERTaggedObject obj = (DERTaggedObject) e.nextElement(); int tagno = (obj == null ? -1 : obj.getTagNo()); switch (tagno) { case 0:// w ww . j a v a2 s .co m this.notBefore = Time.getInstance(obj, bTimeIsExplicit); break; case 1: this.notAfter = Time.getInstance(obj, bTimeIsExplicit); break; default: throw new IllegalArgumentException("invalid asn1 sequence"); } } }
From source file:org.ejbca.core.protocol.cmp.CrmfRequestMessage.java
License:Open Source License
@Override public Date getRequestValidityNotBefore() { Date ret = null;//www . jav a 2 s . c o m final CertTemplate templ = getReq().getCertReq().getCertTemplate(); final OptionalValidity val = templ.getValidity(); if (val != null) { DERSequence valSeq = (DERSequence) val.toASN1Primitive(); ASN1Encodable[] asn1a = valSeq.toArray(); final Time time = Time.getInstance((ASN1TaggedObject) asn1a[0], true); if (time != null) { ret = time.getDate(); } } if (log.isDebugEnabled()) { log.debug("Request validity notBefore is: " + (ret == null ? "null" : ret.toString())); } return ret; }
From source file:org.ejbca.core.protocol.cmp.CrmfRequestMessage.java
License:Open Source License
@Override public Date getRequestValidityNotAfter() { Date ret = null;//from w ww . j a v a2 s. c o m final CertTemplate templ = getReq().getCertReq().getCertTemplate(); final OptionalValidity val = templ.getValidity(); if (val != null) { DERSequence valSeq = (DERSequence) val.toASN1Primitive(); ASN1Encodable[] asn1a = valSeq.toArray(); final Time time = Time.getInstance((ASN1TaggedObject) asn1a[1], true); if (time != null) { ret = time.getDate(); } } if (log.isDebugEnabled()) { log.debug("Request validity notAfter is: " + (ret == null ? "null" : ret.toString())); } return ret; }