public Date getNotBefore() { return c.getStartDate().getDate(); }
public Date getNotBefore() { return c.getStartDate().getDate(); }
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 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 static boolean issues(org.bouncycastle.asn1.x509.Certificate issuerCert, org.bouncycastle.asn1.x509.Certificate cert) throws CertificateEncodingException { Args.notNull(issuerCert, "issuerCert"); Args.notNull(cert, "cert"); boolean issues = issuerCert.getSubject().equals(cert.getIssuer()); if (issues) { byte[] ski = extractSki(issuerCert); byte[] aki = extractAki(cert); if (ski != null) { issues = Arrays.equals(ski, aki); } } if (issues) { long issuerNotBefore = issuerCert.getStartDate().getDate().getTime(); long issuerNotAfter = issuerCert.getEndDate().getDate().getTime(); long notBefore = cert.getStartDate().getDate().getTime(); issues = notBefore <= issuerNotAfter && notBefore >= issuerNotBefore; } return issues; }
public static boolean issues(final org.bouncycastle.asn1.x509.Certificate issuerCert, final org.bouncycastle.asn1.x509.Certificate cert) throws CertificateEncodingException { ParamUtil.requireNonNull("issuerCert", issuerCert); ParamUtil.requireNonNull("cert", cert); boolean issues = issuerCert.getSubject().equals(cert.getIssuer()); if (issues) { byte[] ski = extractSki(issuerCert); byte[] aki = extractAki(cert); if (ski != null) { issues = Arrays.equals(ski, aki); } } if (issues) { long issuerNotBefore = issuerCert.getStartDate().getDate().getTime(); long issuerNotAfter = issuerCert.getEndDate().getDate().getTime(); long notBefore = cert.getStartDate().getDate().getTime(); issues = notBefore <= issuerNotAfter && notBefore >= issuerNotBefore; } return issues; }
@Override protected Object execute0() throws Exception { Certificate cert = X509Util.parseBcCert(IoUtil.read(inFile)); if (serial != null && serial) { return getNumber(cert.getSerialNumber().getPositiveValue()); } else if (subject != null && subject) { return cert.getSubject().toString(); } else if (issuer != null && issuer) { return cert.getIssuer().toString(); } else if (notBefore != null && notBefore) { return toUtcTimeyyyyMMddhhmmssZ(cert.getStartDate().getDate()); } else if (notAfter != null && notAfter) { return toUtcTimeyyyyMMddhhmmssZ(cert.getEndDate().getDate()); } else if (fingerprint != null && fingerprint) { byte[] encoded = cert.getEncoded(); return HashAlgo.getInstance(hashAlgo).hexHash(encoded); } return null; }