Exemplo n.º 1
0
  private void checkManifestValidityTimes(ValidationOptions options, ValidationResult result) {
    DateTime now = new DateTime();
    DateTime nextUpdateTime = getNextUpdateTime();

    if (now.isAfter(nextUpdateTime)) {
      if (nextUpdateTime.plusDays(options.getMaxStaleDays()).isAfter(now)) {
        result.warnIfTrue(true, ValidationString.MANIFEST_PAST_NEXT_UPDATE_TIME);
      } else {
        result.rejectIfTrue(true, ValidationString.MANIFEST_PAST_NEXT_UPDATE_TIME);
      }
    }
  }
  @Before
  public void setUp() {
    certificateRepositoryObjectFetcher = mock(CertificateRepositoryObjectFetcher.class);

    ta = getRootResourceCertificate();
    taContext = new CertificateRepositoryObjectValidationContext(URI.create("rsync://host/ta"), ta);
    workQueue = new LinkedList<CertificateRepositoryObjectValidationContext>();
    validitionResult = ValidationResult.withLocation("ta.cer");
    subject = new TopDownWalker(workQueue, certificateRepositoryObjectFetcher, validitionResult);
  }
Exemplo n.º 3
0
 protected void validateWithCrl(
     String location,
     CertificateRepositoryObjectValidationContext context,
     ValidationOptions options,
     ValidationResult result,
     X509Crl crl) {
   result.setLocation(new ValidationLocation(location));
   checkManifestValidityTimes(options, result);
   X509ResourceCertificateParentChildValidator validator =
       ResourceValidatorFactory.getX509ResourceCertificateStrictValidator(
           context, options, result, crl);
   validator.validate(location, getCertificate());
 }
  protected void logResults(URI uri, ValidationResult result) {

    for (ValidationCheck check :
        result.getAllValidationChecksForLocation(new ValidationLocation(uri))) {
      String message = uri + ": " + ValidationMessage.getMessage(check);
      if (check.isOk()) {
        if (logValidObjects) {
          LOG.debug(check.getStatus() + "->" + message);
        }
      } else {
        LOG.error(check.getStatus() + "->" + message);
      }
    }
  }