RFR: 8313367: SunMSCAPI cannot read Local Computer certs w/o Windows elevation [v3]

Weijun Wang weijun at openjdk.org
Wed Mar 20 19:48:24 UTC 2024


On Tue, 19 Mar 2024 15:23:39 GMT, rebarbora-mckvak <duke at openjdk.org> wrote:

>> This fixes the defect described at https://bugs.openjdk.org/browse/JDK-8313367
>> 
>> If the process does not have write permissions, the store is opened as read-only (instead of failing).
>> 
>> Please note that permissions to use a certificate in a local machine store must be granted - in a management console, select a certificate, right-click -> All tasks... -> Manage Private Keys... -> add Full control to user.
>
> rebarbora-mckvak has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - 8313367: signHash finds a key in the local machine store
>  - 8313367: Local Computer store is opened with max. allowed permissions

src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp line 806:

> 804:             {
> 805:                 // If the key is in a local machine store, we need to try again with CRYPT_MACHINE flag.
> 806:                 // See https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/cryptacquirecontext-troubleshooting

Since you said "if the key is in a local machine store", do you need to check if this is true before retrying with the `CRYPT_MACHINE_KEYSET` flag?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16687#discussion_r1532753649



More information about the security-dev mailing list