use of org.mozilla.jss.asn1.UTCTime in project jss by dogtagpki.
the class CertificateInfo method encodeValidityDate.
/**
* Returns the correct ASN1Value (UTCTime or GeneralizedTime) to represent
* the given certificate validity date.
*/
private static ASN1Value encodeValidityDate(Date d) {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTime(d);
if (cal.get(Calendar.YEAR) <= UTCTIME_CUTOFF_YEAR) {
return new UTCTime(d);
} else {
return new GeneralizedTime(d);
}
}
use of org.mozilla.jss.asn1.UTCTime in project jss by dogtagpki.
the class CertTemplate method dateToASN1.
/**
* Converts a Date into a UTCTime or GeneralizedTime, depending on
* whether it falls before or after the cutoff date.
*/
private static TimeBase dateToASN1(Date d) {
if (d == null) {
return null;
}
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTime(d);
if (cal.get(Calendar.YEAR) <= UTCTIME_CUTOFF_YEAR) {
return new UTCTime(d);
} else {
return new GeneralizedTime(d);
}
}
Aggregations