Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243424

Signature and SignatureSpi get parameter methods may return null when unsupported


    • Subcomponent:
    • Resolved In Build:
    • Verification:
      Not verified


      getParameters has three conflicting problems.

      First, the getParameters() description is very specific:
      - if setParameters is set, the method returns those parameters
      - if not initialized, returns some data
      - otherwise it returns null

      Second, setParameters takes an AlgorithmParametersSpec, but
      getParameters returns an AlgorithmParameter.

      There are cases, EdDSA for one, setParameters() is used for additional Signature operation details, not directly related to properties defined by the algorithm used. getParameters() is expecting the algorithm-specific parameters to be returned when they are unrelated to the operation, and in EdDSA's case is not a part of the public API.

      The third problem is the SPI throws UnsupportedOperatationException for the underlying getParameters() method, but the getParameters() method itself never defined a thrown exception. The method has been defined since 1.4.

      The fix with the least risk for compatibility is to return null when getParameters() is not supported by the algorithm. null is already a defined as a valid return value. It was decided that throwing UnsupportedOperationException was too risky as it maybe incompatible with existing applications.


          Issue Links



              • Assignee:
                ascarpino Anthony Scarpino
                ascarpino Anthony Scarpino
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: