Package org.italiangrid.voms.util
Class CertificateValidatorBuilder
- java.lang.Object
-
- org.italiangrid.voms.util.CertificateValidatorBuilder
-
public class CertificateValidatorBuilder extends java.lang.ObjectA utility class which provides convenient methods to build a certificate validator with defaults that are meaningful for VOMS usage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCertificateValidatorBuilder.OpensslHashFunctionThis enum determine which hash function is configured for the canlOpensslCertChainValidatorto resolve CRLs and other trust anchors files.
-
Field Summary
Fields Modifier and Type Field Description private eu.emi.security.authn.x509.CrlCheckingModecrlChecksstatic eu.emi.security.authn.x509.CrlCheckingModeDEFAULT_CRL_CHECKSThe default CRL checking policy.static eu.emi.security.authn.x509.NamespaceCheckingModeDEFAULT_NS_CHECKSThe default namespace checking policy.static eu.emi.security.authn.x509.OCSPCheckingModeDEFAULT_OCSP_CHECKSThe default OCSP checking policy.static CertificateValidatorBuilder.OpensslHashFunctionDEFAULT_OPENSSL_HASH_FUNCTIONThe default Openssl hash function value.static java.lang.StringDEFAULT_TRUST_ANCHORS_DIRThe default trust anchors directory.static longDEFAULT_TRUST_ANCHORS_UPDATE_INTERVALDefault validator trust anchor update interval.static java.lang.BooleanDEFAULT_VALIDATOR_IS_LAZYBy default this builder builds non-lazy validatorsprivate booleanlazyAnchorsLoadingprivate eu.emi.security.authn.x509.NamespaceCheckingModenamespaceChecksprivate eu.emi.security.authn.x509.OCSPCheckingModeocspChecksprivate CertificateValidatorBuilder.OpensslHashFunctionopensslHashFunctionprivate eu.emi.security.authn.x509.StoreUpdateListenerstoreUpdateListenerprivate java.lang.StringtrustAnchorsDirprivate longtrustAnchorsUpdateIntervalprivate eu.emi.security.authn.x509.ValidationErrorListenervalidationErrorListener
-
Constructor Summary
Constructors Constructor Description CertificateValidatorBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description eu.emi.security.authn.x509.X509CertChainValidatorExtbuild()Builds anOpensslCertChainValidatoraccording to the parameters set for this builderstatic eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator()Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.String trustAnchorsDir)Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener)Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval)Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval, boolean lazy)Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener)Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval)Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval, boolean lazy)Deprecated.Create aCertificateValidatorBuilderobject instead.static eu.emi.security.authn.x509.X509CertChainValidatorExtbuildCertificateValidator(java.lang.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.X509CertChainValidatorExtbuildCertificateValidator(java.lang.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 aCertificateValidatorBuilderobject instead.CertificateValidatorBuildercrlChecks(eu.emi.security.authn.x509.CrlCheckingMode crl)Sets the crl checking mode for this builderCertificateValidatorBuilderlazyAnchorsLoading(boolean lazyness)Sets whether the created validator will be lazy in loading anchorsCertificateValidatorBuildernamespaceChecks(eu.emi.security.authn.x509.NamespaceCheckingMode nsChecks)Sets the namespace checking mode for this builderCertificateValidatorBuilderocspChecks(eu.emi.security.authn.x509.OCSPCheckingMode ocsp)Sets the ocsp checking mode for this builderCertificateValidatorBuilderopensslHashFunction(CertificateValidatorBuilder.OpensslHashFunction f)Sets the openssl hash function for this builderCertificateValidatorBuilderstoreUpdateListener(eu.emi.security.authn.x509.StoreUpdateListener l)Sets the store update listener for this builderCertificateValidatorBuildertrustAnchorsDir(java.lang.String dir)Sets the trust anchors dir for this builderCertificateValidatorBuildertrustAnchorsUpdateInterval(long interval)Sets the trust anchors update interval for this builderCertificateValidatorBuildervalidationErrorListener(eu.emi.security.authn.x509.ValidationErrorListener l)Sets the validation error listener for this builder
-
-
-
Field Detail
-
DEFAULT_OPENSSL_HASH_FUNCTION
public static final CertificateValidatorBuilder.OpensslHashFunction 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_CHECKS
The default CRL checking policy.
-
DEFAULT_OCSP_CHECKS
public static final eu.emi.security.authn.x509.OCSPCheckingMode DEFAULT_OCSP_CHECKS
The default OCSP checking policy.
-
DEFAULT_NS_CHECKS
public static final eu.emi.security.authn.x509.NamespaceCheckingMode DEFAULT_NS_CHECKS
The default namespace checking policy.
-
DEFAULT_TRUST_ANCHORS_DIR
public static final java.lang.String DEFAULT_TRUST_ANCHORS_DIR
The default trust anchors directory.- See Also:
- Constant Field Values
-
DEFAULT_VALIDATOR_IS_LAZY
public static final java.lang.Boolean 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_INTERVAL
Default validator trust anchor update interval.- See Also:
- Constant Field Values
-
trustAnchorsDir
private java.lang.String 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
private CertificateValidatorBuilder.OpensslHashFunction opensslHashFunction
-
-
Method Detail
-
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
public CertificateValidatorBuilder trustAnchorsDir(java.lang.String dir)
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
public CertificateValidatorBuilder trustAnchorsUpdateInterval(long interval)
Sets the trust anchors update interval for this builder- Parameters:
interval- the update interval- Returns:
- the builder object
-
lazyAnchorsLoading
public CertificateValidatorBuilder lazyAnchorsLoading(boolean lazyness)
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
public CertificateValidatorBuilder crlChecks(eu.emi.security.authn.x509.CrlCheckingMode crl)
Sets the crl checking mode for this builder- Parameters:
crl- theCrlCheckingMode- Returns:
- the builder object
-
ocspChecks
public CertificateValidatorBuilder ocspChecks(eu.emi.security.authn.x509.OCSPCheckingMode ocsp)
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 anOpensslCertChainValidatoraccording to the parameters set for this builder- Returns:
- the
X509CertChainValidatorExt
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.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(java.lang.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 aCertificateValidatorBuilderobject 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(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener)Deprecated.Create aCertificateValidatorBuilderobject 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(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener)Deprecated.Create aCertificateValidatorBuilderobject 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(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval, boolean lazy)Deprecated.Create aCertificateValidatorBuilderobject 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(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval)Deprecated.Create aCertificateValidatorBuilderobject 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(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval, boolean lazy)Deprecated.Create aCertificateValidatorBuilderobject 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(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval)Deprecated.Create aCertificateValidatorBuilderobject 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(java.lang.String trustAnchorsDir)
Deprecated.Create aCertificateValidatorBuilderobject 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 aCertificateValidatorBuilderobject instead.Builds an Openssl-style certificate validator.- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
-