RFR: 8209038: Clarify the javadoc of Cipher.getParameters() [v2]

Sean Mullan mullan at openjdk.java.net
Tue Apr 26 19:29:55 UTC 2022


On Tue, 26 Apr 2022 18:28:03 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>>> I can do the Signature update through https://bugs.openjdk.java.net/browse/JDK-8253176 which I have targeted to fix in 19 also.
>> 
>> Ok.
>
> I have filed the PR for the Signature at: https://github.com/openjdk/jdk/pull/8396
> Best to get it done along with this one.

> As for the 2nd sentence, it boils down whether we requires provider to generate default parameters and return it when parameter is required. Existing javadoc states that null is returned when parameter is not required. Given Cipher covers many algorithms, if a provider does not want to generate a default parameter when parameter is required, it can't return null when getParameters() is called.

Ok, maybe we need to reset the context. What was the main issue with the current specification that you were trying to fix? I read the associated bug report. It sounds like there were two issues:

- ProviderException can be thrown, but the method does not declare it in the throws clause. That doesn't seem to be addressed here - do you think it should be?
- cases when null may be returned as opposed to throwing a ProviderException

It could be that what is really just needed is an @throws ProviderException, ex:

"If this cipher implementation requires algorithm parameters to be passed in at initialization but was not initialized with any".

and a slight tweak to the description (changes in italics):

"... if this cipher _can generate required_ algorithm parameters but was not initialized with any."

-------------

PR: https://git.openjdk.java.net/jdk/pull/8117



More information about the security-dev mailing list