mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-27 06:42:05 +01:00
Remove SignatureValidationDateProvider
This commit is contained in:
parent
11b67ea6d2
commit
3be7f12887
2 changed files with 1 additions and 31 deletions
|
@ -46,7 +46,7 @@ public class KeyRingValidator {
|
||||||
|
|
||||||
public static <R extends PGPKeyRing> R validate(R keyRing, Policy policy) {
|
public static <R extends PGPKeyRing> R validate(R keyRing, Policy policy) {
|
||||||
try {
|
try {
|
||||||
return validate(keyRing, policy, policy.getSignatureValidationDate());
|
return validate(keyRing, policy, new Date());
|
||||||
} catch (PGPException e) {
|
} catch (PGPException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.pgpainless.policy;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.pgpainless.algorithm.HashAlgorithm;
|
import org.pgpainless.algorithm.HashAlgorithm;
|
||||||
|
@ -37,7 +36,6 @@ public final class Policy {
|
||||||
HashAlgorithmPolicy.defaultRevocationSignatureHashAlgorithmPolicy();
|
HashAlgorithmPolicy.defaultRevocationSignatureHashAlgorithmPolicy();
|
||||||
private SymmetricKeyAlgorithmPolicy symmetricKeyAlgorithmPolicy =
|
private SymmetricKeyAlgorithmPolicy symmetricKeyAlgorithmPolicy =
|
||||||
SymmetricKeyAlgorithmPolicy.defaultSymmetricKeyAlgorithmPolicy();
|
SymmetricKeyAlgorithmPolicy.defaultSymmetricKeyAlgorithmPolicy();
|
||||||
private ValidationDateProvider signatureValidationDateProvider = getDefaultSignatureValidationDateProvider();
|
|
||||||
private final NotationRegistry notationRegistry = new NotationRegistry();
|
private final NotationRegistry notationRegistry = new NotationRegistry();
|
||||||
|
|
||||||
private Policy() {
|
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.
|
* Return the {@link NotationRegistry} of PGPainless.
|
||||||
* The notation registry is used to decide, whether or not a Notation is known or not.
|
* The notation registry is used to decide, whether or not a Notation is known or not.
|
||||||
|
|
Loading…
Reference in a new issue