/** * Create an instance of {@link XmlRevocation } * */ public XmlRevocation createXmlRevocation() { return new XmlRevocation(); }
public Date getArchiveCutOff() { return revocation.getArchiveCutOff(); }
public byte[] getBinaries() { return revocation.getBase64Encoded(); }
@Test public void failedCertificateRevokedCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setStatus(false); xr.setRevocationDate(CAL1.getTime()); xr.setReason("certificate"); XmlCertificate xc = new XmlCertificate(); xc.getRevocations().add(xr); XmlSubXCV result = new XmlSubXCV(); CertificateRevokedCheck cec = new CertificateRevokedCheck(result, new CertificateWrapper(xc), CAL2.getTime(), constraint, SubContext.CA_CERTIFICATE); cec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void failedRevocationDataFreshCheckWithNullConstraint() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); Date now = new Date(); long nowMil = now.getTime(); xr.setThisUpdate(new Date(nowMil - 129600000)); // 36 hours ago xr.setNextUpdate(new Date(nowMil - 43200000)); // 12 hours ago -> max // freshness is 24 hours xr.setProductionDate(new Date(nowMil - 144000000)); // 20 hours ago -> // not fresh XmlRFC result = new XmlRFC(); RevocationDataFreshCheckWithNullConstraint rdfwncc = new RevocationDataFreshCheckWithNullConstraint(result, new RevocationWrapper(xr), now, constraint); rdfwncc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void failedRevocationDataFreshCheck() throws Exception { TimeConstraint tc = new TimeConstraint(); tc.setUnit(TimeUnit.DAYS); tc.setValue(1); tc.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); Date now = new Date(); long nowMil = now.getTime(); xr.setProductionDate(new Date(nowMil - 172800000)); // 48 hours ago XmlRFC result = new XmlRFC(); RevocationDataFreshCheck rdec = new RevocationDataFreshCheck(result, new RevocationWrapper(xr), now, tc); rdec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void certificateRevokedCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setStatus(false); xr.setReason("certificateHold"); XmlCertificate xc = new XmlCertificate(); xc.getRevocations().add(xr); XmlSubXCV result = new XmlSubXCV(); CertificateRevokedCheck cec = new CertificateRevokedCheck(result, new CertificateWrapper(xc), CAL2.getTime(), constraint, SubContext.CA_CERTIFICATE); cec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void nextUpdateCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setNextUpdate(new Date()); XmlRFC result = new XmlRFC(); NextUpdateCheck nec = new NextUpdateCheck(result, new RevocationWrapper(xr), constraint); nec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void certificateOnHoldCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setStatus(true); XmlCertificate xc = new XmlCertificate(); xc.getRevocations().add(xr); XmlSubXCV result = new XmlSubXCV(); CertificateOnHoldCheck cohc = new CertificateOnHoldCheck(result, new CertificateWrapper(xc), CAL2.getTime(), constraint); cohc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Override protected XmlBasicSignature getCurrentBasicSignature() { return revocation.getBasicSignature(); }
public String getOrigin() { return revocation.getOrigin(); }
@Override protected List<XmlChainItem> getCurrentCertificateChain() { return revocation.getCertificateChain(); }
@Override public String getId() { return revocation.getId(); }
public Date getNextUpdate() { return revocation.getNextUpdate(); }
public Date getExpiredCertsOnCRL() { return revocation.getExpiredCertsOnCRL(); }
public List<XmlDigestAlgoAndValue> getDigestAlgoAndValues() { return revocation.getDigestAlgoAndValues(); }
@Test public void failedCertificateOnHoldCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setStatus(false); xr.setRevocationDate(CAL1.getTime()); xr.setReason("certificateHold"); XmlCertificate xc = new XmlCertificate(); xc.getRevocations().add(xr); XmlSubXCV result = new XmlSubXCV(); CertificateOnHoldCheck cohc = new CertificateOnHoldCheck(result, new CertificateWrapper(xc), CAL2.getTime(), constraint); cohc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); } }
@Test public void revocationDataFreshCheckWithNullConstraint() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); Date now = new Date(); long nowMil = now.getTime(); xr.setThisUpdate(new Date(nowMil - 129600000)); // 36 hours ago xr.setNextUpdate(new Date(nowMil - 43200000)); // 12 hours ago -> max // freshness is 24 hours xr.setProductionDate(new Date(nowMil - 72000000)); // 20 hours ago -> // fresh XmlRFC result = new XmlRFC(); RevocationDataFreshCheckWithNullConstraint rdfwncc = new RevocationDataFreshCheckWithNullConstraint(result, new RevocationWrapper(xr), now, constraint); rdfwncc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void revocationDataFreshCheck() throws Exception { TimeConstraint tc = new TimeConstraint(); tc.setUnit(TimeUnit.DAYS); tc.setValue(1); tc.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); Date now = new Date(); long nowMil = now.getTime(); xr.setProductionDate(new Date(nowMil - 43200000)); // 12 hours ago XmlRFC result = new XmlRFC(); RevocationDataFreshCheck rdec = new RevocationDataFreshCheck(result, new RevocationWrapper(xr), now, tc); rdec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void revocationDataAvailableCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRFC result = new XmlRFC(); RevocationDataAvailableCheck rdac = new RevocationDataAvailableCheck(result, new RevocationWrapper(new XmlRevocation()), constraint); rdac.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }