Class X509RSAExponentValidator

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
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

@ThreadSafe public class X509RSAExponentValidator extends AbstractX509Validator
Validator class to check RSA public exponent values 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 exponent less than or equal to three, with no provision for warnings. This NIST recommendation is for at least 65537 (2**16+1) but it's not obvious where this came from so doesn't seem worth insisting on by default.
Since:
0.9.0
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.shibboleth.metadata.validate.Validator

    Validator.Action
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private BigInteger
    The RSA public exponent value below which an error should result.
    private BigInteger
    The RSA public exponent value below which a warning should result.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static final BigInteger
    bigInteger(long value)
    Private method to wrap construction of BigInteger literals.
    void
    doValidate(X509Certificate cert, Item<?> item, String callerId)
    Apply the validator to the object in the given Item context.
    Get the RSA public exponent below which an error will result.
    Get the RSA public exponent below which a warning will result.
    void
    setErrorBoundary(long length)
    Set the RSA public exponent below which an error should result.
    void
    Set the RSA public exponent below which an error should result.
    void
    setWarningBoundary(long length)
    Set the RSA public exponent below which a warning should result.
    void
    Set the RSA public exponent below which a warning should result.

    Methods inherited from class net.shibboleth.metadata.validate.x509.AbstractX509Validator

    validate

    Methods inherited from class net.shibboleth.metadata.validate.BaseValidator

    addError, addErrorMessage, addErrorMessage, addErrorMessage, addStatus, addWarning, getMessage, makeComponentId, setMessage

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

    setId

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

    doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException

    Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

    checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.shibboleth.shared.component.DestructableComponent

    destroy, isDestroyed

    Methods inherited from interface net.shibboleth.shared.component.IdentifiableComponent

    setId

    Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

    getId

    Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

    initialize, isInitialized

    Methods inherited from interface net.shibboleth.metadata.validate.Validator

    validate
  • Field Details

    • errorBoundary

      @Nonnull private BigInteger errorBoundary
      The RSA public exponent value below which an error should result. Default: 5.
    • warningBoundary

      @Nonnull private BigInteger warningBoundary
      The RSA public exponent value below which a warning should result. Default: 0 (disabled).
  • Constructor Details

    • X509RSAExponentValidator

      public X509RSAExponentValidator()
  • Method Details

    • bigInteger

      @Nonnull private static final BigInteger bigInteger(long value)
      Private method to wrap construction of BigInteger literals.
      Parameters:
      value - value to be converted to BigInteger
      Returns:
      the converted BigInteger
    • getErrorBoundary

      public final BigInteger getErrorBoundary()
      Get the RSA public exponent below which an error will result.
      Returns:
      the RSA public exponent below which an error will result.
    • setErrorBoundary

      public void setErrorBoundary(@Nonnull BigInteger length)
      Set the RSA public exponent below which an error should result.
      Parameters:
      length - the RSA public exponent below which an error should result
    • setErrorBoundary

      public void setErrorBoundary(long length)
      Set the RSA public exponent below which an error should result.
      Parameters:
      length - the RSA public exponent below which an error should result
    • getWarningBoundary

      public final BigInteger getWarningBoundary()
      Get the RSA public exponent below which a warning will result.
      Returns:
      the RSA public exponent below which a warning will result.
    • setWarningBoundary

      public void setWarningBoundary(@Nonnull BigInteger length)
      Set the RSA public exponent below which a warning should result.
      Parameters:
      length - the RSA public exponent below which a warning should result
    • setWarningBoundary

      public void setWarningBoundary(long length)
      Set the RSA public exponent below which a warning should result.
      Parameters:
      length - the RSA public exponent below which a warning should result
    • doValidate

      public void doValidate(@Nonnull X509Certificate cert, @Nonnull Item<?> item, @Nonnull String callerId)
      Description copied from class: AbstractX509Validator
      Apply the validator to the object in the given Item context. The validator influences future processing by adding item metadata to the Item.
      Specified by:
      doValidate in class AbstractX509Validator
      Parameters:
      cert - the certificate to be validated
      item - the Item context for the validation
      callerId - a String identifying the caller