Example usage for org.bouncycastle.asn1.crmf OptionalValidity toASN1Primitive

List of usage examples for org.bouncycastle.asn1.crmf OptionalValidity toASN1Primitive

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.crmf OptionalValidity toASN1Primitive.

Prototype

public ASN1Primitive toASN1Primitive() 

Source Link

Document

 OptionalValidity ::= SEQUENCE { notBefore  [0] Time OPTIONAL, notAfter   [1] Time OPTIONAL } --at least one MUST be present 

Usage

From source file:org.ejbca.core.protocol.cmp.CrmfRequestMessage.java

License:Open Source License

@Override
public Date getRequestValidityNotBefore() {
    Date ret = null;/*from   w w  w .  j  a v  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 w w  .j  a v a 2  s . com
    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;
}