use of org.mozilla.jss.asn1.NULL 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);
}
}
use of org.mozilla.jss.asn1.NULL in project jss by dogtagpki.
the class ProofOfPossession method encode.
@Override
public void encode(OutputStream ostream) throws IOException {
if (type == RA_VERIFIED) {
(new NULL()).encode(Tag.get(0), ostream);
} else if (type == SIGNATURE) {
signature.encode(Tag.get(1), ostream);
} else if (type == KEY_ENCIPHERMENT) {
// a CHOICE must be explicitly tagged
EXPLICIT e = new EXPLICIT(Tag.get(2), keyEncipherment);
e.encode(ostream);
} else {
assert (type == KEY_AGREEMENT);
// a CHOICE must be explicitly tagged
EXPLICIT e = new EXPLICIT(Tag.get(3), keyAgreement);
e.encode(ostream);
}
}
Aggregations