/** * This method returns the DSS abbreviation of the CRLToken. It is used for * debugging purpose. * * @return the DSS abbreviation of the CRLToken */ @Override public String getAbbreviation() { return "CRLToken[" + (productionDate == null ? "?" : DSSUtils.formatInternal(productionDate)) + ", signedBy=" + getIssuerX500Principal() + "]"; }
@Override public String toString(String indentStr) { StringBuilder out = new StringBuilder(); out.append(indentStr).append("CRLToken[\n"); indentStr += "\t"; out.append(indentStr).append("Production time: ").append(productionDate == null ? "?" : DSSUtils.formatInternal(productionDate)).append('\n'); out.append(indentStr).append("Signature algorithm: ").append(signatureAlgorithm == null ? "?" : signatureAlgorithm).append('\n'); out.append(indentStr).append("Status: ").append(getStatus()).append('\n'); out.append(indentStr).append("Issuer's certificate: ").append(getIssuerX500Principal()).append('\n'); indentStr = indentStr.substring(1); out.append(indentStr).append(']'); return out.toString(); }
@Test public void testOK() throws IOException { FileDocument doc = new FileDocument("src/test/resources/crl/belgium2.crl"); FileDocument caCert = new FileDocument("src/test/resources/belgiumrs2.crt"); FileDocument tsaCert = new FileDocument("src/test/resources/TSA_BE.cer"); try (InputStream crlStream = doc.openStream()) { CRLValidity crlValidity = CRLUtils.isValidCRL(crlStream, DSSUtils.loadCertificate(caCert.openStream())); assertNotNull(crlValidity); assertTrue(crlValidity.isSignatureIntact()); assertTrue(crlValidity.isCrlSignKeyUsage()); assertTrue(crlValidity.isIssuerX509PrincipalMatches()); CRLToken crl = new CRLToken(DSSUtils.loadCertificate(tsaCert.openStream()), crlValidity); assertNotNull(crl); assertNotNull(crl.getAbbreviation()); assertNotNull(crl.getCreationDate()); assertNotNull(crl.getCrlValidity()); assertNotNull(crl.getDSSId()); assertNotNull(crl.getIssuerX500Principal()); assertNotNull(crl.getPublicKeyOfTheSigner()); assertNotNull(crl.getOrigin()); assertNotNull(crl.toString()); assertEquals(crlValidity.getExpiredCertsOnCRL(), crl.getExpiredCertsOnCRL()); assertNull(crl.getCertHash()); assertNull(crl.getArchiveCutOff()); } }