Example usage for org.bouncycastle.asn1 DERUTCTime getAdjustedTime

List of usage examples for org.bouncycastle.asn1 DERUTCTime getAdjustedTime

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 DERUTCTime getAdjustedTime.

Prototype

public String getAdjustedTime() 

Source Link

Document

Return a time string as an adjusted date with a 4 digit year.

Usage

From source file:net.sf.portecle.crypto.X509Ext.java

License:Open Source License

/**
 * Get Microsoft CRL Next Publish (1.3.6.1.4.1.311.21.4) extension value as a string.
 * // w ww  .  j  a v a2 s.  c o  m
 * @param bValue The octet string value
 * @return Extension value as a string
 * @throws IOException If an I/O problem occurs
 */
private String getMicrosoftCrlNextPublish(byte[] bValue) throws IOException {
    DERUTCTime time = (DERUTCTime) ASN1Primitive.fromByteArray(bValue);
    String date = time.getAdjustedTime();
    try {
        date = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG)
                .format(time.getAdjustedDate());
    } catch (ParseException e) {
        // Ignored
    }
    return escapeHtml(date);
}