RFR: 8265372: Simplify PKCS9Attribute

Weijun Wang weijun at openjdk.org
Tue Jan 2 21:56:46 UTC 2024


On Tue, 2 Jan 2024 18:22:51 GMT, Ben Perez <duke at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java line 186:
>> 
>>> 184:     /**
>>> 185:      * Array of attribute OIDs defined in PKCS9, by number.
>>> 186:      */
>> 
>> I don't think `PKCS9_OIDS` is useful now. It's used in `PKCS9Attributes.getAttributes()` but this method is used nowhere. It's also used in `PKCS9Attributes.toString` but we can just iterate through `attributes` there. I don't see a reason to print the attributes in this order. If we want to print them in the order they appear in the data, we can use `LinkedHashMap` to in `PKCS9Attributes`. `Hashtable` is a little stale.
>
> Do you think we can remove `PKCS9Attributes.getAttributes()` entirely or should we just modify it to not use `PKCS9_OIDS` anymore?

I think we can remove both. There is no need to keep a useless method as long as it's not an exported API.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17132#discussion_r1439897759



More information about the security-dev mailing list