RFR: 8298420: PEM API: Implementation (Preview) [v14]
Weijun Wang
weijun at openjdk.org
Mon Apr 28 16:58:57 UTC 2025
On Sat, 26 Apr 2025 07:57:42 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:
>> src/java.base/share/classes/java/security/PEMRecord.java line 135:
>>
>>> 133: /**
>>> 134: * Returns the binary encoding from the Base64 data contained in
>>> 135: * {@code pem}.
>>
>> The name does not sound correct to me. PEM encodes binary data to an ASCII string, so "encoding" is the ASCII string. How about just `getData`?
>
> `PEMRecord` implements `DEREncodable` which all the classes return DER through `getEncoded()`. I is consistent with the other implementing classes.
I understand the intent, though `PEMRecord` is a very special `DEREncodable`. In other cases, `DEREncodable` objects contain information to be encoded into DER, while here the content is already DER and then encoded to Base64. In that sense, I almost want to call it a `DERDecodable`. :-)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2064097399
More information about the security-dev
mailing list