RFR: 8298420: PEM API: Implementation (Preview) [v9]
Weijun Wang
weijun at openjdk.org
Wed Oct 30 23:17:47 UTC 2024
On Mon, 21 Oct 2024 19:52:36 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:
>> 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 JDK24 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](https://bugs.openjdk.org/browse/JDK-8300911).
>>
>> Thanks
>>
>> Tony
>
> Anthony Scarpino has updated the pull request incrementally with one additional commit since the last revision:
>
> apparently <p> can't be before a @implNote.. Who know.
Comments for `PEMDecoder`.
src/java.base/share/classes/java/security/PEMDecoder.java line 231:
> 229: * algorithm-specific operations, or {@code X509EncodedKeySpec} if the
> 230: * X.509 binary encoding is desired instead of a Key object. An IOException
> 231: * will be thrown if the class is incorrect for the given PEM data.
There is no IOE in this method.
src/java.base/share/classes/java/security/PEMDecoder.java line 282:
> 280: }
> 281:
> 282: DEREncodable so = decode(pem);
The line above could throw IOE. Shall we wrap it in an IAE?
src/java.base/share/classes/java/security/PEMDecoder.java line 358:
> 356:
> 357: /**
> 358: * Configures and returns a new {@code PEMDecoder} instance from the
Are you going to be more specific on what kind of factories will be involved?
src/java.base/share/classes/java/security/PEMDecoder.java line 361:
> 359: * current instance that will use Factory classes from the specified
> 360: * {@link Provider}. Any errors using the {@code provider} will occur
> 361: * during decoding.
Do you mean errors will happen during decoding? Do you want to be clear on what exceptions will be thrown?
src/java.base/share/classes/java/security/PEMDecoder.java line 367:
> 365: *
> 366: * @param provider the Factory provider.
> 367: * @return a new PEM decoder instance.
The return spec for this method and the next one should be using a consistent wording.
-------------
PR Review: https://git.openjdk.org/jdk/pull/17543#pullrequestreview-2406603002
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r1823572147
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r1823579945
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r1823573986
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r1823576032
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r1823576439
More information about the security-dev
mailing list