/** * Create an instance of {@link XmlSubXCV } * */ public XmlSubXCV createXmlSubXCV() { return new XmlSubXCV(); }
public SubX509CertificateValidation(CertificateWrapper currentCertificate, Date currentTime, Context context, SubContext subContext, ValidationPolicy validationPolicy) { super(new XmlSubXCV()); result.setId(currentCertificate.getId()); result.setTrustAnchor(currentCertificate.isTrusted()); this.currentCertificate = currentCertificate; this.currentTime = currentTime; this.context = context; this.subContext = subContext; this.validationPolicy = validationPolicy; }
@Test public void idPkixOcspNoCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlSubXCV result = new XmlSubXCV(); IdPkixOcspNoCheck ic = new IdPkixOcspNoCheck(result, constraint); ic.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()); }
@Test public void failedOrganizationUnitCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Invalid_Org"); XmlCertificate xc = new XmlCertificate(); xc.setOrganizationalUnit("Valid_Org"); XmlSubXCV result = new XmlSubXCV(); OrganizationUnitCheck ouc = new OrganizationUnitCheck(result, new CertificateWrapper(xc), constraint); ouc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void failedCertificateQualifiedCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlCertificate xc = new XmlCertificate(); XmlSubXCV result = new XmlSubXCV(); CertificateQualifiedCheck cqc = new CertificateQualifiedCheck(result, new CertificateWrapper(xc), constraint); cqc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void pseudonymCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Valid_Pseudonym"); XmlCertificate xc = new XmlCertificate(); xc.setPseudonym("Valid_Pseudonym"); XmlSubXCV result = new XmlSubXCV(); PseudonymCheck pc = new PseudonymCheck(result, new CertificateWrapper(xc), constraint); pc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void failedCommonNameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Invalid_Name"); XmlCertificate xc = new XmlCertificate(); xc.setCommonName("Valid_Name"); XmlSubXCV result = new XmlSubXCV(); CommonNameCheck cnc = new CommonNameCheck(result, new CertificateWrapper(xc), constraint); cnc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void failedSurnameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Invalid_Surname"); XmlCertificate xc = new XmlCertificate(); xc.setSurname("Valid_Surname"); XmlSubXCV result = new XmlSubXCV(); SurnameCheck sc = new SurnameCheck(result, new CertificateWrapper(xc), constraint); sc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void failedOrganizationNameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Invalid_Org"); XmlCertificate xc = new XmlCertificate(); xc.setOrganizationName("Valid_Org"); XmlSubXCV result = new XmlSubXCV(); OrganizationNameCheck onc = new OrganizationNameCheck(result, new CertificateWrapper(xc), constraint); onc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void failedGivenNameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Invalid_Name"); XmlCertificate xc = new XmlCertificate(); xc.setGivenName("Valid_Name"); XmlSubXCV result = new XmlSubXCV(); GivenNameCheck gnc = new GivenNameCheck(result, new CertificateWrapper(xc), constraint); gnc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void countryCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("BE"); XmlCertificate xc = new XmlCertificate(); xc.setCountryName("BE"); XmlSubXCV result = new XmlSubXCV(); CountryCheck cc = new CountryCheck(result, new CertificateWrapper(xc), constraint); cc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void commonNameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Valid_Name"); XmlCertificate xc = new XmlCertificate(); xc.setCommonName("Valid_Name"); XmlSubXCV result = new XmlSubXCV(); CommonNameCheck cnc = new CommonNameCheck(result, new CertificateWrapper(xc), constraint); cnc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void givenNameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Valid_Name"); XmlCertificate xc = new XmlCertificate(); xc.setGivenName("Valid_Name"); XmlSubXCV result = new XmlSubXCV(); GivenNameCheck gnc = new GivenNameCheck(result, new CertificateWrapper(xc), constraint); gnc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void failedCountryCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("BE"); XmlCertificate xc = new XmlCertificate(); xc.setCountryName("LU"); XmlSubXCV result = new XmlSubXCV(); CountryCheck cc = new CountryCheck(result, new CertificateWrapper(xc), constraint); cc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void surnameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Valid_Surname"); XmlCertificate xc = new XmlCertificate(); xc.setSurname("Valid_Surname"); XmlSubXCV result = new XmlSubXCV(); SurnameCheck sc = new SurnameCheck(result, new CertificateWrapper(xc), constraint); sc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void failedPseudonymCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Invalid_Pseudonym"); XmlCertificate xc = new XmlCertificate(); xc.setPseudonym("Valid_Pseudonym"); XmlSubXCV result = new XmlSubXCV(); PseudonymCheck pc = new PseudonymCheck(result, new CertificateWrapper(xc), constraint); pc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void organizationUnitCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Valid_Org"); XmlCertificate xc = new XmlCertificate(); xc.setOrganizationalUnit("Valid_Org"); XmlSubXCV result = new XmlSubXCV(); OrganizationUnitCheck ouc = new OrganizationUnitCheck(result, new CertificateWrapper(xc), constraint); ouc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void organizationNameCheck() throws Exception { MultiValuesConstraint constraint = new MultiValuesConstraint(); constraint.setLevel(Level.FAIL); constraint.getId().add("Valid_Org"); XmlCertificate xc = new XmlCertificate(); xc.setOrganizationName("Valid_Org"); XmlSubXCV result = new XmlSubXCV(); OrganizationNameCheck onc = new OrganizationNameCheck(result, new CertificateWrapper(xc), constraint); onc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void certificateSignatureValidCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlBasicSignature xbs = new XmlBasicSignature(); xbs.setSignatureValid(true); XmlCertificate xc = new XmlCertificate(); xc.setBasicSignature(xbs); XmlSubXCV result = new XmlSubXCV(); CertificateSignatureValidCheck<XmlSubXCV> csvc = new CertificateSignatureValidCheck<XmlSubXCV>(result, new CertificateWrapper(xc), constraint); csvc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }