-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8360463: Ambiguity in Cipher.getInstance() specification between NoSuchAlgorithmException and NoSuchPaddingException #26489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…chAlgorithmException and NoSuchPaddingException
👋 Welcome back valeriep! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@valeriepeng The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
/csr |
@valeriepeng has indicated that a compatibility and specification (CSR) request is needed for this pull request. @valeriepeng please create a CSR request for issue JDK-8360463 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
Webrevs
|
Changes look good with minor suggestions. |
* | ||
* @throws NoSuchPaddingException if {@code transformation} | ||
* contains a padding scheme that is not available | ||
* @throws NoSuchPaddingException if a {@code CipherSpi} object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will change~
* @throws NoSuchPaddingException if {@code transformation} | ||
* contains a padding scheme that is not available | ||
* @throws NoSuchPaddingException if a {@code CipherSpi} object | ||
* from the {@code provider} is found using the algorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will change~
* | ||
* @throws NoSuchPaddingException if {@code transformation} | ||
* contains a padding scheme that is not available | ||
* @throws NoSuchPaddingException if the {@code CipherSpi} object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same suggestion as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
* @throws NoSuchPaddingException if {@code transformation} | ||
* contains a padding scheme that is not available | ||
* @throws NoSuchPaddingException if the {@code CipherSpi} object | ||
* from the {@code provider} is found using the algorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same suggestion as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Is it worth demonstrating the different behaviors with a test? |
This is covered by existing TCK test and thus the request for clarification. This is provider-specific, i.e. depending on how provider registers its implementation, it may leads to different exceptions. Given that the difference is only the type of exception, e.g. |
This PR is for clarifying the
NoSuchAlgorithmException
andNoSuchPaddingException
for theCipher.getInstance(String transformation, Provider provider)
andCipher.getInstance(String transformation, String provider)
methods.As stated in
javax.crypto.CipherSpi
class, provider has the flexibility to register their implementations through various sub-transformations. As a result, depending on how the providers register the implementation, it may lead toNoSuchAlgorithmException
orNoSuchPaddingException
. For example, the provider A registers to support "AES/CBC/PKCS5Padding" vs provider B registers to support "AES" (but would only accept "CBC" and "PKCS5Padding" as the valid input for setting mode and padding). CallingCipher.getInstance(...)
with "AES/CBC/NoPadding" against provider A and B would lead toNoSuchAlgorithmException
andNoSuchPaddingException
. This javadoc update hope to make it clear.Thanks in advance for the review~
Valerie
Progress
Issues
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26489/head:pull/26489
$ git checkout pull/26489
Update a local copy of the PR:
$ git checkout pull/26489
$ git pull https://git.openjdk.org/jdk.git pull/26489/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26489
View PR using the GUI difftool:
$ git pr show -t 26489
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26489.diff
Using Webrev
Link to Webrev Comment