Package org.italiangrid.voms.util
Class CertificateValidatorBuilder
java.lang.Object
org.italiangrid.voms.util.CertificateValidatorBuilder
A utility class which provides convenient methods to build a certificate
validator with defaults that are meaningful for VOMS usage.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
This enum determine which hash function is configured for the canlOpensslCertChainValidator
to resolve CRLs and other trust anchors files. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate eu.emi.security.authn.x509.CrlCheckingMode
static final eu.emi.security.authn.x509.CrlCheckingMode
The default CRL checking policy.static final eu.emi.security.authn.x509.NamespaceCheckingMode
The default namespace checking policy.static final eu.emi.security.authn.x509.OCSPCheckingMode
The default OCSP checking policy.static final CertificateValidatorBuilder.OpensslHashFunction
The default Openssl hash function value.static final String
The default trust anchors directory.static final long
Default validator trust anchor update interval.static final Boolean
By default this builder builds non-lazy validatorsprivate boolean
private eu.emi.security.authn.x509.NamespaceCheckingMode
private eu.emi.security.authn.x509.OCSPCheckingMode
private eu.emi.security.authn.x509.StoreUpdateListener
private String
private long
private eu.emi.security.authn.x509.ValidationErrorListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioneu.emi.security.authn.x509.X509CertChainValidatorExt
build()
Builds anOpensslCertChainValidator
according to the parameters set for this builderstatic eu.emi.security.authn.x509.X509CertChainValidatorExt
Deprecated.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir) Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener) Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval) Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval, boolean lazy) Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener) Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval) Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval, boolean lazy) Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks) Builds an Openssl-style certificate validator configured as specified in the parametersstatic eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator
(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks, boolean lazy) Deprecated.Create aCertificateValidatorBuilder
object instead.crlChecks
(eu.emi.security.authn.x509.CrlCheckingMode crl) Sets the crl checking mode for this builderlazyAnchorsLoading
(boolean lazyness) Sets whether the created validator will be lazy in loading anchorsnamespaceChecks
(eu.emi.security.authn.x509.NamespaceCheckingMode nsChecks) Sets the namespace checking mode for this builderocspChecks
(eu.emi.security.authn.x509.OCSPCheckingMode ocsp) Sets the ocsp checking mode for this builderSets the openssl hash function for this builderstoreUpdateListener
(eu.emi.security.authn.x509.StoreUpdateListener l) Sets the store update listener for this buildertrustAnchorsDir
(String dir) Sets the trust anchors dir for this buildertrustAnchorsUpdateInterval
(long interval) Sets the trust anchors update interval for this buildervalidationErrorListener
(eu.emi.security.authn.x509.ValidationErrorListener l) Sets the validation error listener for this builder
-
Field Details
-
DEFAULT_OPENSSL_HASH_FUNCTION
The default Openssl hash function value. MD5 is chosen to ensure compatibility with Openssl pre 1.0 deployments. -
DEFAULT_CRL_CHECKS
public static final eu.emi.security.authn.x509.CrlCheckingMode DEFAULT_CRL_CHECKSThe default CRL checking policy. -
DEFAULT_OCSP_CHECKS
public static final eu.emi.security.authn.x509.OCSPCheckingMode DEFAULT_OCSP_CHECKSThe default OCSP checking policy. -
DEFAULT_NS_CHECKS
public static final eu.emi.security.authn.x509.NamespaceCheckingMode DEFAULT_NS_CHECKSThe default namespace checking policy. -
DEFAULT_TRUST_ANCHORS_DIR
The default trust anchors directory.- See Also:
-
DEFAULT_VALIDATOR_IS_LAZY
By default this builder builds non-lazy validators -
DEFAULT_TRUST_ANCHORS_UPDATE_INTERVAL
public static final long DEFAULT_TRUST_ANCHORS_UPDATE_INTERVALDefault validator trust anchor update interval.- See Also:
-
trustAnchorsDir
-
validationErrorListener
private eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener -
storeUpdateListener
private eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener -
trustAnchorsUpdateInterval
private long trustAnchorsUpdateInterval -
lazyAnchorsLoading
private boolean lazyAnchorsLoading -
namespaceChecks
private eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks -
crlChecks
private eu.emi.security.authn.x509.CrlCheckingMode crlChecks -
ocspChecks
private eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks -
opensslHashFunction
-
-
Constructor Details
-
CertificateValidatorBuilder
public CertificateValidatorBuilder()
-
-
Method Details
-
opensslHashFunction
public CertificateValidatorBuilder opensslHashFunction(CertificateValidatorBuilder.OpensslHashFunction f) Sets the openssl hash function for this builder- Parameters:
f
- theCertificateValidatorBuilder.OpensslHashFunction
- Returns:
- the builder object
-
storeUpdateListener
public CertificateValidatorBuilder storeUpdateListener(eu.emi.security.authn.x509.StoreUpdateListener l) Sets the store update listener for this builder- Parameters:
l
- theStoreUpdateListener
- Returns:
- the builder object
-
trustAnchorsDir
Sets the trust anchors dir for this builder- Parameters:
dir
- the trust anchors directory- Returns:
- the builder object
-
validationErrorListener
public CertificateValidatorBuilder validationErrorListener(eu.emi.security.authn.x509.ValidationErrorListener l) Sets the validation error listener for this builder- Parameters:
l
- theValidationErrorListener
- Returns:
- the builder object
-
trustAnchorsUpdateInterval
Sets the trust anchors update interval for this builder- Parameters:
interval
- the update interval- Returns:
- the builder object
-
lazyAnchorsLoading
Sets whether the created validator will be lazy in loading anchors- Parameters:
lazyness
- the boolean flag that determines if the validator will be lazy in loading trust anchors- Returns:
- the builder object
-
namespaceChecks
public CertificateValidatorBuilder namespaceChecks(eu.emi.security.authn.x509.NamespaceCheckingMode nsChecks) Sets the namespace checking mode for this builder- Parameters:
nsChecks
- theNamespaceCheckingMode
- Returns:
- the builder object
-
crlChecks
Sets the crl checking mode for this builder- Parameters:
crl
- theCrlCheckingMode
- Returns:
- the builder object
-
ocspChecks
Sets the ocsp checking mode for this builder- Parameters:
ocsp
- theOCSPCheckingMode
- Returns:
- the builder object
-
build
public eu.emi.security.authn.x509.X509CertChainValidatorExt build()Builds anOpensslCertChainValidator
according to the parameters set for this builder- Returns:
- the
X509CertChainValidatorExt
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks) Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreUpdateListener
- the listener that will receive notifications about trust store update eventsupdateInterval
- the trust anchor store update intervalnamespaceChecks
- the namespace checking policycrlChecks
- the crl checking policyocspChecks
- the ocsp checking policy- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks, boolean lazy) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreUpdateListener
- the listener that will receive notifications about trust store update eventsupdateInterval
- the trust anchor store update intervalnamespaceChecks
- the namespace checking policycrlChecks
- the crl checking policyocspChecks
- the ocsp checking policylazy
- whether the validator should be lazy in loading crls and certificates- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errors- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreListener
- the listener that will be informed of trust store load errors- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval, boolean lazy) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreListener
- the listener that will be informed of trust store load errorsupdateInterval
- the trust anchor store update intervallazy
- whether the certificate validator should be lazy in loading crls and CAs- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreListener
- the listener that will be informed of trust store load errorsupdateInterval
- the trust anchor store update interval- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval, boolean lazy) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsupdateInterval
- the trust anchor store update intervallazy
- whether the certificate validator should be lazy in loading crls and CAs- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsupdateInterval
- the trust anchor store update interval- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(String trustAnchorsDir) Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded from- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
@Deprecated public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator()Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator.- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
CertificateValidatorBuilder
object instead.