Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-24 Thread Valerie Peng
On Tue, 23 Mar 2021 01:01:14 GMT, Valerie Peng wrote: >> P11PrivateKey is private so we cannot check that. Our options to figure out >> if something is sensitive are: >> 1. See if it doesn't implement `RSAPrivateKey` (this yields the prior >> snippet with `implGetSoftwareFactory()`) >> 2. Try

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-22 Thread Valerie Peng
On Sat, 20 Mar 2021 19:24:45 GMT, SalusaSecondus wrote: >> We seem to have a choice and I'm not sure the best way to approach this. >> >> 1. We trust the properties in `P11Key` and just ask it if the values are >> both sensitive and extractable. [1] >> 2. But if we already trust P11Key, why

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-22 Thread Valerie Peng
On Sat, 20 Mar 2021 17:41:45 GMT, SalusaSecondus wrote: >> I think that this code will work, but since there already is >> [P11RSAPrivateKey and >>

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-20 Thread SalusaSecondus
On Sat, 20 Mar 2021 18:43:34 GMT, SalusaSecondus wrote: >> Mike, >> >> From what I can find, if you try to get a spec from a non-extractable key >> you'll get an `InvalidKeySpecException`. >> 1. `C_GetAttributeValue`will throw a `PKCS11Exception` >> 2. The `PKCS11Exception` gets caught in >>

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-20 Thread Michael StJohns
On 3/20/2021 2:46 PM, SalusaSecondus wrote: On Sat, 20 Mar 2021 17:52:00 GMT, SalusaSecondus wrote: @valeriepeng Sorry for the delay. There were unknown Windows build failure during the pre-submit tests that I have to rebase my commits on top of the master tip. This new revision should

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-20 Thread SalusaSecondus
On Sat, 20 Mar 2021 17:52:00 GMT, SalusaSecondus wrote: >> @valeriepeng Sorry for the delay. There were unknown Windows build failure >> during the pre-submit tests that I have to rebase my commits on top of the >> master tip. This new revision should cover all comments you left before. >>

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-20 Thread Michael StJohns
On 3/20/2021 1:54 PM, SalusaSecondus wrote: On Thu, 18 Mar 2021 20:25:59 GMT, Ziyi Luo wrote: This looks to cover the cases and fixes we talked about. @valeriepeng Sorry for the delay. There were unknown Windows build failure during the pre-submit tests that I have to rebase my commits on

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-20 Thread SalusaSecondus
On Thu, 18 Mar 2021 20:25:59 GMT, Ziyi Luo wrote: >> This looks to cover the cases and fixes we talked about. > > @valeriepeng Sorry for the delay. There were unknown Windows build failure > during the pre-submit tests that I have to rebase my commits on top of the > master tip. This new

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-20 Thread SalusaSecondus
On Fri, 19 Mar 2021 19:42:10 GMT, SalusaSecondus wrote: >> Well, for `P11RSAKeyFactory`, I think some minor modification may be needed >> given the additional P11PrivateKey type. >> I'd expect it to be something like: >> // must be either RSAPrivateKeySpec or RSAPrivateCrtKeySpec >>

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-19 Thread SalusaSecondus
On Fri, 19 Mar 2021 18:21:12 GMT, Valerie Peng wrote: >> I like this flow and think that it's clearer. >> >> One question: Do you think we could use this code almost character for >> character in the `P11RSAKeyFactory`? The keys handled should be descendants >> of `RSAPrivateCrtKey`,

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-19 Thread Michael StJohns
On 3/19/2021 2:24 PM, Valerie Peng wrote: some* reason (even if I cannot figure out why). Well, for `P11RSAKeyFactory`, I think some minor modification may be needed given the additional P11PrivateKey type. I'd expect it to be something like: // must be either RSAPrivateKeySpec or

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-19 Thread Valerie Peng
On Fri, 19 Mar 2021 03:18:35 GMT, SalusaSecondus wrote: >> src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java line 430: >> >>> 428: } else if >>> (keySpec.isAssignableFrom(RSA_PRIVCRT_KEYSPEC_CLS)) { >>> 429: throw new InvalidKeySpecException >>> 430:

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-18 Thread SalusaSecondus
On Thu, 18 Mar 2021 23:17:51 GMT, Valerie Peng wrote: >> Ziyi Luo has updated the pull request with a new target base due to a merge >> or a rebase. The pull request now contains four commits: >> >> - Fix P11RSAKeyFactory and add one more jtreg test >> - Add one test case for the regression

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-18 Thread Valerie Peng
On Thu, 18 Mar 2021 17:30:55 GMT, Ziyi Luo 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: >> >>

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-18 Thread Ziyi Luo
On Thu, 18 Mar 2021 18:57:57 GMT, SalusaSecondus wrote: >> Ziyi Luo has updated the pull request with a new target base due to a merge >> or a rebase. The pull request now contains four commits: >> >> - Fix P11RSAKeyFactory and add one more jtreg test >> - Add one test case for the

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-18 Thread SalusaSecondus
On Thu, 18 Mar 2021 17:30:55 GMT, Ziyi Luo 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: >> >>

Re: RFR: 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec [v4]

2021-03-18 Thread Ziyi Luo
> 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` > >