Class X509RSAKeyLengthValidator
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.validate.BaseValidator
net.shibboleth.metadata.validate.x509.AbstractX509Validator
net.shibboleth.metadata.validate.x509.X509RSAKeyLengthValidator
- All Implemented Interfaces:
Validator<X509Certificate>,net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
Validator class to check RSA key lengths in X.509 certificates.
An instance of the class can be configured to have both a warning boundary and an
error boundary. The default is to give an error for any key smaller than 2048 bits,
with no provision for warnings. This seems the right long term default.
During the transition to 2048-bit keys, it may be appropriate to set the warning
boundary to 2048 bits and the error boundary to 1024 bits.
- Since:
- 0.9.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.shibboleth.metadata.validate.Validator
Validator.Action -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe RSA key length below which an error should result.private intThe RSA key length below which a warning should result. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoValidate(X509Certificate cert, Item<?> item, String callerId) Apply the validator to the object in the givenItemcontext.final intGet the RSA key length below which an error will result.final intGet the RSA key length below which a warning will result.voidsetErrorBoundary(int length) Set the RSA key length below which an error should result.voidsetWarningBoundary(int length) Set the RSA key length below which a warning should result.Methods inherited from class net.shibboleth.metadata.validate.x509.AbstractX509Validator
validateMethods inherited from class net.shibboleth.metadata.validate.BaseValidator
addError, addErrorMessage, addErrorMessage, addErrorMessage, addStatus, addWarning, getMessage, makeComponentId, setMessageMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiableComponent
setIdMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
errorBoundary
private int errorBoundaryThe RSA key length below which an error should result. Default: 2048. -
warningBoundary
private int warningBoundaryThe RSA key length below which a warning should result. Default: 0 (disabled).
-
-
Constructor Details
-
X509RSAKeyLengthValidator
public X509RSAKeyLengthValidator()
-
-
Method Details
-
getErrorBoundary
public final int getErrorBoundary()Get the RSA key length below which an error will result.- Returns:
- the RSA key length below which an error will result.
-
setErrorBoundary
public void setErrorBoundary(int length) Set the RSA key length below which an error should result.- Parameters:
length- the RSA key length below which an error should result
-
getWarningBoundary
public final int getWarningBoundary()Get the RSA key length below which a warning will result.- Returns:
- the RSA key length below which a warning will result.
-
setWarningBoundary
public void setWarningBoundary(int length) Set the RSA key length below which a warning should result.- Parameters:
length- the RSA key length below which a warning should result
-
doValidate
public void doValidate(@Nonnull X509Certificate cert, @Nonnull Item<?> item, @Nonnull String callerId) Description copied from class:AbstractX509ValidatorApply the validator to the object in the givenItemcontext. The validator influences future processing by adding item metadata to theItem.- Specified by:
doValidatein classAbstractX509Validator- Parameters:
cert- the certificate to be validateditem- theItemcontext for the validationcallerId- aStringidentifying the caller
-