RFR: 8279254: PKCS9Attribute SigningTime always encoded in UTFTime [v3]

Jamil Nimeh jnimeh at openjdk.org
Fri Jun 23 07:42:10 UTC 2023


On Thu, 22 Jun 2023 23:22:14 GMT, Ben Perez <duke at openjdk.org> wrote:

>> Added single-argument `putTime` method to `DerOutputStream` that selects the correct encoding based on the `Date` value. Similarly, a `getTime` method was added to `DerValue` to automatically call the correct decoding function based on the date type specified by the `tag`. Furthermore, the `encode` method in `PKCS9Attribute` was changed to utilize the new `putTime` method.
>
> Ben Perez has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Fixed epoch literals to be in milliseconds
>  - Updated copyright in DerInputStream

src/java.base/share/classes/sun/security/util/DerOutputStream.java line 490:

> 488:     public DerOutputStream putTime(Date d) {
> 489:         Date low = new Date(-631152000000L); // Dates before 1/1/1950
> 490:         Date high = new Date(2524607999000L); // Dates after 12/31/2049

Could these be `private static final` since they are constants?  It would avoid the extra constructor calls each time this method is called.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14617#discussion_r1239478167



More information about the security-dev mailing list