From 3be7f12887a48410c456aebcf81023172322587f Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 15 May 2021 20:30:21 +0200 Subject: [PATCH] Remove SignatureValidationDateProvider --- .../org/pgpainless/key/KeyRingValidator.java | 2 +- .../java/org/pgpainless/policy/Policy.java | 30 ------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/KeyRingValidator.java b/pgpainless-core/src/main/java/org/pgpainless/key/KeyRingValidator.java index 598dc2d3..35a7176a 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/KeyRingValidator.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/KeyRingValidator.java @@ -46,7 +46,7 @@ public class KeyRingValidator { public static R validate(R keyRing, Policy policy) { try { - return validate(keyRing, policy, policy.getSignatureValidationDate()); + return validate(keyRing, policy, new Date()); } catch (PGPException e) { return null; } diff --git a/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java b/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java index e179c1e7..b2f63e21 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java +++ b/pgpainless-core/src/main/java/org/pgpainless/policy/Policy.java @@ -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.