Example usage for org.bouncycastle.asn1 ASN1UTCTime getTime

List of usage examples for org.bouncycastle.asn1 ASN1UTCTime getTime

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 ASN1UTCTime getTime.

Prototype

public String getTime() 

Source Link

Document

Return the time - always in the form of YYMMDDhhmmssGMT(+hh:mm|-hh:mm).

Usage

From source file:net.sf.keystore_explorer.crypto.x509.X509Ext.java

License:Open Source License

private String getMsCrlNextPublishStringValue(byte[] octets) {
    ASN1UTCTime time = ASN1UTCTime.getInstance(octets);
    return time.getTime();
}

From source file:net.sf.keystore_explorer.utilities.asn1.Asn1Dump.java

License:Open Source License

private String dumpUTCTime(ASN1UTCTime asn1Time) {
    StringBuilder sb = new StringBuilder();

    sb.append(indentSequence.toString(indentLevel));
    sb.append("UTC TIME=");

    // UTCTime, note does not support ms precision hence the different date format
    Date date;// ww w.  j  ava 2s .  c  o m
    try {
        date = asn1Time.getDate();
    } catch (ParseException e) {
        throw new RuntimeException("Cannot parse utc time");
    }
    String formattedDate = new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss z").format(date);

    sb.append(formattedDate);
    sb.append(" (");
    sb.append(asn1Time.getTime());
    sb.append(")");
    sb.append(NEWLINE);

    return sb.toString();
}