Example usage for org.bouncycastle.asn1.cms Time getDate

List of usage examples for org.bouncycastle.asn1.cms Time getDate

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.cms Time getDate.

Prototype

public Date getDate() 

Source Link

Document

Get java.util.Date version of date+time.

Usage

From source file:mitm.common.security.smime.SMIMEAttributeUtils.java

License:Open Source License

/**
 * Returns the Date from the given signing time attribute 
 * @param signingTimeAttribute/*from  ww w.  j a  v  a  2  s. c  om*/
 * @return
 */
public static Date getSigningTime(Attribute signingTimeAttribute) {
    Date date = null;

    if (signingTimeAttribute != null) {
        Time time = Time.getInstance(signingTimeAttribute.getAttrValues().getObjectAt(0).toASN1Primitive());

        if (time != null) {
            date = time.getDate();
        }
    }

    return date;
}

From source file:net.ripe.rpki.commons.crypto.cms.RpkiSignedObjectParser.java

License:BSD License

private boolean verifyAndStoreSigningTime(SignerInformation signer) {
    Attribute signingTimeAttibute = signer.getSignedAttributes().get(CMSAttributes.signingTime);
    if (!validationResult.rejectIfNull(signingTimeAttibute, SIGNING_TIME_ATTR_PRESENT)) {
        return false;
    }//from  w  w  w . j  a  va  2 s .co m
    if (!validationResult.rejectIfFalse(signingTimeAttibute.getAttrValues().size() == 1,
            ONLY_ONE_SIGNING_TIME_ATTR)) {
        return false;
    }

    Time signingTimeDate = Time.getInstance(signingTimeAttibute.getAttrValues().getObjectAt(0));
    signingTime = new DateTime(signingTimeDate.getDate().getTime(), DateTimeZone.UTC);
    return true;
}