JDK-8243424 : Signature and SignatureSpi get parameter methods may return null when unsupported
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2020-04-22
  • Updated: 2020-07-07
  • Resolved: 2020-06-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15 b27Fixed
Related Reports
CSR :  
Relates :  
Sub Tasks
JDK-8248982 :  
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.
URL: https://hg.openjdk.java.net/jdk/jdk/rev/e0cd01ac5d31 User: ascarpino Date: 2020-06-08 17:46:20 +0000