RFR: 8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards
Ziyi Luo
luoziyi at openjdk.java.net
Tue Mar 2 17:26:15 UTC 2021
On Wed, 24 Feb 2021 02:39:57 GMT, Jamil Nimeh <jnimeh at openjdk.org> wrote:
>> All of the "isAssignableFrom" checks in "engineGetKeySpec" appear to be backwards in Java's KeyFactorySpi.engineGetKeySpec implementations. In most cases, the requested KeySpec is equal to the concrete implementation so the inversion does not matter. But there are few cases, as presented in the added jtreg test, will cause unexpected behavior (e.g., ClassCastException rather than an InvalidKeySpecException). The fix is trivial.
>>
>> Co-author @SalusaSecondus
>
> The fix itself makes sense and looks good to me. However I think it will cause two other tests to break. Please try running the following two tests with your changes and see if they fail for you as they did for me:
> open/test/jdk/sun/security/rsa/TestKeyFactory.java
> open/test/jdk/sun/security/rsa/pss/TestPSSKeySupport.java
>
> Also just a minor nit: some of the modified files should have their copyright dates updated to 2021.
Hi Jamil,
Thanks for reviewing this PR.
> The fix itself makes sense and looks good to me. However I think it will cause two other tests to break. Please try running the following two tests with your changes and see if they fail for you as they did for me:
> open/test/jdk/sun/security/rsa/TestKeyFactory.java
> open/test/jdk/sun/security/rsa/pss/TestPSSKeySupport.java
Nice catch. I updated both tests in rev-2.
> Also just a minor nit: some of the modified files should have their copyright dates updated to 2021.
Done
-------------
PR: https://git.openjdk.java.net/jdk/pull/2682
More information about the security-dev
mailing list