Integrated: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec
Ziyi Luo
luoziyi at openjdk.java.net
Mon Mar 29 20:18:41 UTC 2021
On Thu, 11 Mar 2021 19:51:19 GMT, Ziyi Luo <luoziyi at openjdk.org> wrote:
> This is a P2 regression introduced by JDK-8254717.
>
> In `RSAKeyFactory.engineGetKeySpec`, when the key is a RSA key and the KeySpec is RSAPrivateKeySpec or RSAPrivateCrtKeySpec. The method behavior is described as follow:
>
> X-axis: type of `keySpec`
> Y-axis: type of `key`
>
> Before JDK-8254717:
>
> | | RSAPrivateKeySpec.class | RSAPrivateCrtKeySpec.class |
> |--|--|--|
> | RSAPrivateKey | Return RSAPrivateKeySpec | Throw `InvalidKeySpecException` |
> | RSAPrivateCrtKey | Return RSAPrivateKeySpec | Return RSAPrivateKeyCrtSpec |
>
> After JDK-8254717 (Green check is what we want to fix, red cross is the regression):
>
> | | RSAPrivateKeySpec.class | RSAPrivateCrtKeySpec.class |
> |--|--|--|
> | RSAPrivateKey | Throw `InvalidKeySpecException` ❌ | Throw `InvalidKeySpecException` |
> | RSAPrivateCrtKey | Return RSAPrivateKeyCrtSpec ✅ | Return RSAPrivateKeyCrtSpec |
>
> This commit fixes the regression.
>
>
> ### Tests
>
> * Jtreg: All tests under `java/security`, `sun/security`, `javax/crypto` passed
> * JCK: All JCK-16 (I do not have jCK-17)tests under `api/java_security` passed
This pull request has now been integrated.
Changeset: a5d7de23
Author: Ziyi Luo <luoziyi at openjdk.org>
Committer: Valerie Peng <valeriep at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/a5d7de23
Stats: 311 lines in 6 files changed: 253 ins; 24 del; 34 mod
8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec
Co-authored-by: Greg Rubin <rubin at amazon.com>
Reviewed-by: valeriep
-------------
PR: https://git.openjdk.java.net/jdk/pull/2949
More information about the security-dev
mailing list