New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK-6782021: It is not possible to read local computer certificates with the SunMSCAPI provider #8211
Conversation
👋 Welcome back macarte! A progress list of the required criteria for merging this PR into |
Webrevs
|
Thanks a lot for the quick contribution! I'll definitely be happy to sponsor it. Since new keystore types are created, this needs a CSR. Go to https://bugs.openjdk.java.net/browse/JDK-6782021, click "More" and at the end there is a "Create CSR". Basically you talk about what these new keystores are and why they are useful. The scope is JDK and I assume the compatibility risk is low. There is no spec change but you can suggest new entries in the "JDK Providers Documentation" (https://docs.oracle.com/en/java/javase/18/security/oracle-providers.html#GUID-4F1737D6-1569-4340-B140-678C70E63CD5). You can also add a label like |
/csr |
@wangweij has indicated that a compatibility and specification (CSR) request is needed for this pull request. |
Actually the Windows API is using a reverse naming system, so I would propose the following changes:
|
Please see draft CSR: https://bugs.openjdk.java.net/browse/JDK-8284850 |
The CSR looks fine. It's not necessary to attach a patch there. At least don't name it BTW, how do you think of the names proposed in #8211 (comment)? |
I don't use this API much so I don't really have an opinion as a customer regarding the format of the strings used to identify the key stores. I'd be happy to review a separate PR but I think this falls outside the scope of this PR which specifically targets the inability to access local machine key stores (which a bug has been raised against). note: there's also a "Windows-PRNG" which isn't a key store but the native random number generator |
src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/CKeyStore.java
Outdated
Show resolved
Hide resolved
@macarte I've added my name as reviewer in the CSR. You can either propose it (if you expect some feedback from the CSR reviewers) or just finalize it (if you think the change is simple and obvious). |
Also, please remove trailing spaces and create a new commit. Skara dislikes trailing spaces and TAB characters in source code. |
@wangweij - I believe the change to be simple enough I'll go ahead and finalize it. However, I've proposed updates to the documentation, how are these actioned, i.e. what steps are required of me? |
I filed a doc task at https://bugs.openjdk.java.net/browse/JDK-8286141. It will be picked up by the doc team. We will also need to write a release note. If you have any recommended text, you can write here. |
Found an issue with my editor where whitespace was not being rendered :( - will check the diff in future |
src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/CKeyStore.java
Outdated
Show resolved
Hide resolved
src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/CKeyStore.java
Outdated
Show resolved
Hide resolved
I'd like to contribute a test. Please modify it as much as you like. You can put it inside
|
@wangweij - regarding the two tests for localmachine, these will throw a KeyStore exception "Access denied" if the test is not run as admin, is there anyway in the test to make that a requirement? If so we could split into two tests, one in admin that does all and one in non-admin that does the currentuser tests |
Oops, I didn't realized that. Yes, you can divide it to 2 tests. The one needs admin privilege can be tagged |
@wangweij - I added your test and updated to handle Access Denied errors due to admin rights missing, in this case we ignore the test The CSR has been finalized and I feel we are ready to close out this PR |
Great. After the CSR is approved I will approve this PR as well. Then you will need to type the |
@macarte Can you explain more on when an "access denied" error could happen? I create a normal user in my local AD and didn't see that. We might need to talk about this in the release note. |
Hi @christophbrejla, thanks for making a comment in an OpenJDK project! All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user christophbrejla for the summary. If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use. |
@christophbrejla - my goal is to backport to latest (18 or 19), 17 and 11 |
Then please add the versions to the "Fix Version(s)" field of the CSR. There are also some questions waiting for you in the comment there. |
@macarte I think Sean's comment on your CSR about the scope is correct. The "algorithm" name should be at the JDK level so user knows what to write in their app. Once you think there's no more to update, you can finalize the CSR. |
/integrate |
@macarte This pull request has not yet been marked as ready for integration. |
Appologies i misread the process - waiting for @wangweij to approve |
@macarte This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 489 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@wangweij) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
/sponsor |
/sponsor |
Going to push as commit 5e5500c.
Your commit was automatically rebased without conflicts. |
@wangweij The command |
<!-- Start of TOU acceptance message header -->
Hi @christophbrejla, thanks for making a comment in an OpenJDK project!
All comments and discussions in the OpenJDK Community must be made available under the OpenJDK [Terms of Use](https://openjdk.java.net/legal/tou/). If you already are an OpenJDK [Author](https://openjdk.java.net/bylaws#author), [Committer](https://openjdk.java.net/bylaws#committer) or [Reviewer](https://openjdk.java.net/bylaws#reviewer), please click [here](https://bugs.openjdk.java.net/secure/CreateIssue.jspa?pid=11300&issuetype=1) to open a new issue so that we can record that fact. Please Use "Add GitHub user christophbrejla for the summary.
If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
<!-- End of TOU acceptance message header -->
- [ ] I agree to the [OpenJDK Terms of Use](https://openjdk.java.net/legal/tou/) for all comments I make in a project in the [OpenJDK GitHub organization](https://github.com/openjdk).
<!-- Start of TOU acceptance message footer -->
Your comment will be automatically restored once you have accepted the OpenJDK [Terms of Use](https://openjdk.java.net/legal/tou/).
<!-- End of TOU acceptance message footer -->
<!-- Original message to be restored:
Hello+%40macarte+%3Chttps%3A%2F%2Fgithub.com%2Fmacarte%3E%0A%0Athanks+for+the+info.+I+dont+know+how+much+work+it+would+be%2C+but+if+it+is+not+too+much+of+a+hassle+i+would+much+appreciate+if+you+also+backport+to+version+8.+%0A%0Athank+you+very+much%0A%0A%3E+On+11+May+2022%2C+at+17%3A55%2C+Mat+Carter+***%40***.***%3E+wrote%3A%0A%3E+%0A%3E+%0A%3E+%40christophbrejla+%3Chttps%3A%2F%2Fgithub.com%2Fchristophbrejla%3E+-+my+goal+is+to+backport+to+latest+%2818+or+19%29%2C+17+and+11%0A%3E+%0A%3E+%E2%80%94%0A%3E+Reply+to+this+email+directly%2C+view+it+on+GitHub+%3Chttps%3A%2F%2Fgithub.com%2Fopenjdk%2Fjdk%2Fpull%2F8211%23issuecomment-1123959699%3E%2C+or+unsubscribe+%3Chttps%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPWW5GYTCXXEXUI2UGWJGBTVJPKAPANCNFSM5TIH5GZQ%3E.%0A%3E+You+are+receiving+this+because+you+were+mentioned.%0A%3E+%0A%0A
-->
|
On Windows you can now access the local machine keystores using the strings "Windows-MY-LOCALMACHINE" and "Windows-ROOT-LOCALMACHINE"; note the application requires admin privileges.
"Windows-MY" and "Windows-ROOT" remain unchanged, however given these original keystore strings mapped to the current user, I added "Windows-MY-CURRENTUSER" and "Windows-ROOT-CURRENTUSER" so that a developer can explicitly specify the current user location. These two new strings simply map to the original two strings, i.e. no duplication of code paths etc
No new tests added, keystore functionality and API remains unchanged, the local machine keystore types would require the tests to run in admin mode
Tested on windows, passes tier1 and tier2 tests
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8211/head:pull/8211
$ git checkout pull/8211
Update a local copy of the PR:
$ git checkout pull/8211
$ git pull https://git.openjdk.java.net/jdk pull/8211/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8211
View PR using the GUI difftool:
$ git pr show -t 8211
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8211.diff