コード例 #1
0
 @Override
 protected void verifySimpleReport(SimpleReport simpleReport) {
   super.verifySimpleReport(simpleReport);
   Indication indication = simpleReport.getIndication(simpleReport.getFirstSignatureId());
   assertEquals(Indication.INDETERMINATE, indication);
   SubIndication subIndication = simpleReport.getSubIndication(simpleReport.getFirstSignatureId());
   assertEquals(SubIndication.NO_CERTIFICATE_CHAIN_FOUND, subIndication);
 }
コード例 #2
0
  @Test
  public void passedOutOfBoundsWithTimestamps() throws Exception {
    FileInputStream fis =
        new FileInputStream("src/test/resources/passed_out_of_bounds_with_timestamps.xml");
    DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class);
    assertNotNull(diagnosticData);

    CustomProcessExecutor executor = new CustomProcessExecutor();
    executor.setDiagnosticData(diagnosticData);
    executor.setValidationPolicy(loadPolicy());
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    Date currentTime = sdf.parse("04/05/2016 15:15:00");
    executor.setCurrentTime(currentTime);

    Reports reports = executor.execute();
    assertNotNull(reports);

    SimpleReport simpleReport = reports.getSimpleReport();
    assertEquals(
        Indication.TOTAL_PASSED, simpleReport.getIndication(simpleReport.getFirstSignatureId()));

    DetailedReport detailedReport = reports.getDetailedReport();
    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getBasicValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.OUT_OF_BOUNDS_NO_POE,
        detailedReport.getBasicValidationSubIndication(simpleReport.getFirstSignatureId()));

    List<String> timestampIds = detailedReport.getTimestampIds();
    assertEquals(5, timestampIds.size());
    for (String tspId : timestampIds) {
      assertEquals(Indication.PASSED, detailedReport.getTimestampValidationIndication(tspId));
    }

    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getLongTermValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.OUT_OF_BOUNDS_NO_POE,
        detailedReport.getLongTermValidationSubIndication(simpleReport.getFirstSignatureId()));

    assertEquals(
        Indication.PASSED,
        detailedReport.getArchiveDataValidationIndication(simpleReport.getFirstSignatureId()));
  }
コード例 #3
0
  @Test
  public void noPoeRevokedNoTimestamp() throws Exception {
    FileInputStream fis = new FileInputStream("src/test/resources/no_poe_revoked_no_timestamp.xml");
    DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class);
    assertNotNull(diagnosticData);

    CustomProcessExecutor executor = new CustomProcessExecutor();
    executor.setDiagnosticData(diagnosticData);
    executor.setValidationPolicy(loadPolicy());
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    Date currentTime = sdf.parse("04/05/2016 15:10:00");
    executor.setCurrentTime(currentTime);

    Reports reports = executor.execute();
    assertNotNull(reports);

    SimpleReport simpleReport = reports.getSimpleReport();
    assertEquals(
        Indication.INDETERMINATE, simpleReport.getIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.NO_POE, simpleReport.getSubIndication(simpleReport.getFirstSignatureId()));

    DetailedReport detailedReport = reports.getDetailedReport();
    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getBasicValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.REVOKED_NO_POE,
        detailedReport.getBasicValidationSubIndication(simpleReport.getFirstSignatureId()));

    assertEquals(0, detailedReport.getTimestampIds().size());

    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getLongTermValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.REVOKED_NO_POE,
        detailedReport.getLongTermValidationSubIndication(simpleReport.getFirstSignatureId()));

    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getArchiveDataValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.NO_POE,
        detailedReport.getArchiveDataValidationSubIndication(simpleReport.getFirstSignatureId()));
  }
コード例 #4
0
  @Test
  public void signingCertificateNotFound() throws Exception {
    FileInputStream fis =
        new FileInputStream("src/test/resources/signing_certificate_not_found.xml");
    DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class);
    assertNotNull(diagnosticData);

    CustomProcessExecutor executor = new CustomProcessExecutor();
    executor.setDiagnosticData(diagnosticData);
    executor.setValidationPolicy(loadPolicy());
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    Date currentTime = sdf.parse("04/05/2016 15:55:00");
    executor.setCurrentTime(currentTime);

    Reports reports = executor.execute();
    assertNotNull(reports);

    SimpleReport simpleReport = reports.getSimpleReport();
    assertEquals(
        Indication.INDETERMINATE, simpleReport.getIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.NO_SIGNING_CERTIFICATE_FOUND,
        simpleReport.getSubIndication(simpleReport.getFirstSignatureId()));

    DetailedReport detailedReport = reports.getDetailedReport();
    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getBasicValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.NO_SIGNING_CERTIFICATE_FOUND,
        detailedReport.getBasicValidationSubIndication(simpleReport.getFirstSignatureId()));

    assertEquals(0, detailedReport.getTimestampIds().size());

    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getLongTermValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.NO_SIGNING_CERTIFICATE_FOUND,
        detailedReport.getLongTermValidationSubIndication(simpleReport.getFirstSignatureId()));

    assertEquals(
        Indication.INDETERMINATE,
        detailedReport.getArchiveDataValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.NO_SIGNING_CERTIFICATE_FOUND,
        detailedReport.getArchiveDataValidationSubIndication(simpleReport.getFirstSignatureId()));
  }
コード例 #5
0
  @Test
  public void sigConstraintFailure() throws Exception {
    FileInputStream fis = new FileInputStream("src/test/resources/sig_constraint_failure.xml");
    DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class);
    assertNotNull(diagnosticData);

    CustomProcessExecutor executor = new CustomProcessExecutor();
    executor.setDiagnosticData(diagnosticData);
    executor.setValidationPolicy(loadPolicy());
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    Date currentTime = sdf.parse("04/05/2016 15:55:00");
    executor.setCurrentTime(currentTime);

    Reports reports = executor.execute();
    assertNotNull(reports);

    SimpleReport simpleReport = reports.getSimpleReport();
    assertEquals(
        Indication.TOTAL_FAILED, simpleReport.getIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.SIG_CONSTRAINTS_FAILURE,
        simpleReport.getSubIndication(simpleReport.getFirstSignatureId()));

    DetailedReport detailedReport = reports.getDetailedReport();
    assertEquals(
        Indication.FAILED,
        detailedReport.getBasicValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.SIG_CONSTRAINTS_FAILURE,
        detailedReport.getBasicValidationSubIndication(simpleReport.getFirstSignatureId()));

    assertEquals(0, detailedReport.getTimestampIds().size());

    assertEquals(
        Indication.FAILED,
        detailedReport.getLongTermValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.SIG_CONSTRAINTS_FAILURE,
        detailedReport.getLongTermValidationSubIndication(simpleReport.getFirstSignatureId()));

    assertEquals(
        Indication.FAILED,
        detailedReport.getArchiveDataValidationIndication(simpleReport.getFirstSignatureId()));
    assertEquals(
        SubIndication.SIG_CONSTRAINTS_FAILURE,
        detailedReport.getArchiveDataValidationSubIndication(simpleReport.getFirstSignatureId()));
  }