Remove SignatureValidationDateProvider

This commit is contained in:
Paul Schaub 2021-05-15 20:30:21 +02:00
parent 11b67ea6d2
commit 3be7f12887
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
2 changed files with 1 additions and 31 deletions

View File

@ -46,7 +46,7 @@ public class KeyRingValidator {
public static <R extends PGPKeyRing> R validate(R keyRing, Policy policy) {
try {
return validate(keyRing, policy, policy.getSignatureValidationDate());
return validate(keyRing, policy, new Date());
} catch (PGPException e) {
return null;
}

View File

@ -17,7 +17,6 @@ package org.pgpainless.policy;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.pgpainless.algorithm.HashAlgorithm;
@ -37,7 +36,6 @@ public final class Policy {
HashAlgorithmPolicy.defaultRevocationSignatureHashAlgorithmPolicy();
private SymmetricKeyAlgorithmPolicy symmetricKeyAlgorithmPolicy =
SymmetricKeyAlgorithmPolicy.defaultSymmetricKeyAlgorithmPolicy();
private ValidationDateProvider signatureValidationDateProvider = getDefaultSignatureValidationDateProvider();
private final NotationRegistry notationRegistry = new NotationRegistry();
private Policy() {
@ -256,34 +254,6 @@ public final class Policy {
}
}
public Date getSignatureValidationDate() {
return getSignatureValidationDateProvider().getValidationDate();
}
public ValidationDateProvider getDefaultSignatureValidationDateProvider() {
return new ValidationDateProvider() {
@Override
public Date getValidationDate() {
return new Date(); // now
}
};
}
public ValidationDateProvider getSignatureValidationDateProvider() {
return signatureValidationDateProvider;
}
public void setValidationDateProvider(ValidationDateProvider validationDateProvider) {
if (validationDateProvider == null) {
throw new NullPointerException("ValidationDateProvider MUST NOT be null.");
}
this.signatureValidationDateProvider = validationDateProvider;
}
public interface ValidationDateProvider {
Date getValidationDate();
}
/**
* Return the {@link NotationRegistry} of PGPainless.
* The notation registry is used to decide, whether or not a Notation is known or not.