On Thu, 19 Nov 2026 13:34:20 GMT, Weijun Wang <[email protected]> wrote:

>> Please review this fix for SunMSCAPI storing and removing certs in 
>> `CURRENTUSER` even when a `LOCALMACHINE` keystore is selected.
>> 
>> The native `storeCertificate` and `removeCertificate` methods currently use 
>> `CertOpenSystemStore`, which opens the `CURRENTUSER` store.
>> This fix passes the store location through JNI and uses `CertOpenStore` with 
>> `CERT_SYSTEM_STORE_LOCAL_MACHINE` for `LOCALMACHINE` keystores.
>> 
>> The manual regression test `LocalMachineStore` verifies certificate 
>> placement and deletion; the test requires administrator privileges.
>> 
>> Testing:
>> - `LocalMachineStore`
>> - manual `keytool -genkeypair`, `-list` and `-delete`
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> The test only checks certificate entries, have you tried private key entries?

Thanks for reviewing @wangweij,

Thanks for pointing this out. 
Private key containers were still being created in `CURRENTUSER`;
I've fixed their creation and deletion as well.

I've added private key coverage to the test and manually verified machine key 
storage and deletion with `keytool`.

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

PR Comment: https://git.openjdk.org/jdk/pull/33785#issuecomment-7080170729

Reply via email to