public Date getThisUpdate() { return c.getThisUpdate().getDate(); }
public void setEndDate( ASN1UTCTime endDate) { this.endDate = new Time(endDate); }
if (signingTime != null) Time timeInstance = Time.getInstance(signingTime.getAttrValues().getObjectAt(0)); try certFromSignedData.checkValidity(timeInstance.getDate()); System.out.println("Certificate valid at signing time: " + timeInstance.getDate());
private static void checkTime(Time time, ValidationIssue issue) { ASN1Primitive asn1Time = time.toASN1Primitive(); if (time.getDate().getTime() / 1000 < EPOCHTIME_2050010100) { if (!(asn1Time instanceof ASN1UTCTime)) { issue.setFailureMessage("not encoded as UTCTime"); } } else { if (!(asn1Time instanceof ASN1GeneralizedTime)) { issue.setFailureMessage("not encoded as GeneralizedTime"); } } }
protected void extractExpiredCertsOnCRL(CRLValidity validity, byte[] expiredCertsOnCRLBinaries) { if (expiredCertsOnCRLBinaries != null) { try { ASN1OctetString octetString = (ASN1OctetString) ASN1Primitive.fromByteArray(expiredCertsOnCRLBinaries); Time time = Time.getInstance(ASN1Primitive.fromByteArray(octetString.getOctets())); if (time != null && time.toASN1Primitive() instanceof ASN1GeneralizedTime) { validity.setExpiredCertsOnCRL(time.getDate()); } else { LOG.warn("Attribute 'expiredCertsOnCRL' found but ignored (should be encoded as ASN.1 GeneralizedTime)"); } } catch (Exception e) { LOG.error("Unable to parse expiredCertsOnCRL on CRL : " + e.getMessage(), e); } } }
public static Time getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(obj.getObject()); // must be explicitly tagged }
public X509CRL getCrl(BigInteger crlNumber) throws OperationException { LOG.info(" START getCrl: ca={}, crlNumber={}", caIdent.getName(), crlNumber); boolean successful = false; try { byte[] encodedCrl = certstore.getEncodedCrl(caIdent, crlNumber); if (encodedCrl == null) { return null; } try { X509CRL crl = X509Util.parseCrl(encodedCrl); successful = true; if (LOG.isInfoEnabled()) { String timeStr = new Time(crl.getThisUpdate()).getTime(); LOG.info("SUCCESSFUL getCrl: ca={}, thisUpdate={}", caIdent.getName(), timeStr); } return crl; } catch (CRLException | CertificateException ex) { throw new OperationException(SYSTEM_FAILURE, ex); } catch (RuntimeException ex) { throw new OperationException(SYSTEM_FAILURE, ex); } } finally { if (!successful) { LOG.info(" FAILED getCrl: ca={}", caIdent.getName()); } } } // method getCrl
public String toString() { return getTime(); } }
public static Time getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(obj.getObject()); // must be explicitly tagged }
public String toString() { return getTime(); } }
public Date getNotBefore() { return c.getStartDate().getDate(); }
public void setEndDate( ASN1UTCTime endDate) { this.endDate = new Time(endDate); }
public static Date getDate(ASN1Encodable encodable) { try { return Time.getInstance(encodable).getDate(); } catch (Exception e) { LOG.warn("Unable to retrieve the date : " + encodable, e); return null; } }
private Time rebuildASN1Time(int tagNo, byte[] array) throws IOException { // Tag UTC or GeneralizedTime return Time.getInstance(rebuildASN1Primitive(tagNo, array)); }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }
public Date getThisUpdate() { return c.getThisUpdate().getDate(); }
public void setStartDate( ASN1UTCTime startDate) { this.startDate = new Time(startDate); }
if (signingTime != null) Time timeInstance = Time.getInstance(signingTime.getAttrValues().getObjectAt(0)); try certFromSignedData.checkValidity(timeInstance.getDate()); System.out.println("Certificate valid at signing time: " + timeInstance.getDate());
public Time getRevocationDate() { return Time.getInstance(seq.getObjectAt(1)); }
public void checkValidity( Date date) throws CertificateExpiredException, CertificateNotYetValidException { if (date.getTime() > this.getNotAfter().getTime()) // for other VM compatibility { throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime()); } if (date.getTime() < this.getNotBefore().getTime()) { throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime()); } }