-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8298420: Implement JEP 470: PEM Encodings of Cryptographic Objects (Preview) #17543
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
Conversation
|
👋 Welcome back ascarpino! A progress list of the required criteria for merging this PR into |
|
@ascarpino The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
|
@ascarpino 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 231 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. ➡️ To integrate this PR with the above commit message to the |
|
@ascarpino this pull request can not be integrated into git checkout pem
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Fixed P8v2 0xA0 Test: Use EKPI with PBEParameters to match EPK8 base64 cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few remaining very minor comments. This is looking really good now.
src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java
Outdated
Show resolved
Hide resolved
| * | ||
| * @param type the type identifier in the PEM header without PEM syntax labels. | ||
| * For a public key, {@code type} would be "PUBLIC KEY". | ||
| * @param pem any data between the PEM header and footer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here 'pem' - any data between the PEM header and footer.
But the constructor description below for both the constructors
"pem the Base64-encoded data encapsulated by the PEM header and footer"
Observation
If I pass the data between PEM header and footer, the PEMRecord created successfully.
If I include Header and Footer
For eg as pem string,
"-----BEGIN PUBLIC KEY-----\n" +
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDGRGrflwdiorIrC02pmr0jAKXI\n" +
"qxbBHxMUslLg8bjJiJCbanW7g7j7fR3RwGVU0cWh8rsQ/y4U7Yy0gBAsWCrr/TDS\n" +
"Xf3RWiZbQiQo6brZFiFZ5WgWgTpuzxDKpzLjyXCe17FXgbgEYscRPB/Rff6q2OS4\n" +
"H6stY3fHctzmU1HmUQIDAQAB\n" +
"-----END PUBLIC KEY-----";
PEMRecord creation throws java.lang.IllegalArgumentException: Illegal footer:
Looks some inconsistency in documentation/ behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code requires a end of line character. Perhaps the documentation can be clarified later
| * public key will be returned in that format. Any type of PEM data can be | ||
| * decoded into a {@code PEMRecord} by specifying {@code PEMRecord.class}. | ||
| * If the Class parameter doesn't match the PEM content, an | ||
| * {@code IllegalArgumentException} will be thrown. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks a Typo, it supposed to be ClassCastException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.. I can follow up on this with post integration.
| * from the specified {@link Provider} to produce cryptographic objects. | ||
| * Any errors using the {@code Provider} will occur during decoding. | ||
| * | ||
| * <p>If {@code provider} is {@code null}, a new instance is returned with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this could use some clarification post-integration
|
/integrate |
|
Going to push as commit bb2c80c.
Your commit was automatically rebased without conflicts. |
|
@ascarpino Pushed as commit bb2c80c. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
| */ | ||
|
|
||
| public class EncryptedPrivateKeyInfo { | ||
| public non-sealed class EncryptedPrivateKeyInfo implements DEREncodable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed in the latest versions of the JEPs.
Hi all,
I need a code review of the PEM API. Privacy-Enhanced Mail (PEM) is a format for encoding and decoding cryptographic keys and certificates. It will be integrated into JDK25 as a Preview Feature. Preview features does not permanently define the API and it is subject to change in future releases until it is finalized.
Details about this change can be seen at PEM API JEP.
Thanks
Tony
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17543/head:pull/17543$ git checkout pull/17543Update a local copy of the PR:
$ git checkout pull/17543$ git pull https://git.openjdk.org/jdk.git pull/17543/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17543View PR using the GUI difftool:
$ git pr show -t 17543Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17543.diff
Using Webrev
Link to Webrev Comment