RFR: 8374808: Add new methods to KeyStore and KeyStoreSpi that return the creation date as an Instant instead of Date [v2]

Mikhail Yankelevich myankelevich at openjdk.org
Thu Jan 15 11:26:54 UTC 2026


On Wed, 14 Jan 2026 21:12:30 GMT, Weijun Wang <weijun at openjdk.org> wrote:

> Some comments.
> 
> I have a small concern on the `Instant.now()` calls everywhere. As you can see in your `TestKeyStoreBasic.java` test, the value is truncated when persisting inside a keystore and when loaded again it's not identical to the old value. Will this create any interop issue in the real world? If we know a keystore implementation only support the precision of milliseconds, should we truncate it early?

I believe this would be the safest thing to do. Existing implementation is relying on `new Date()` which is actually calling `System.currentTimeMillis()` which is sufficient. Even though it shouldn't cause any interop issues as Date still remains unchanged `Instant` values can cause confusion as in the test.

I have changed these 'Instant.now()' to `Instant.now().truncatedTo(ChronoUnit.MILLIS);`

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

PR Comment: https://git.openjdk.org/jdk/pull/29140#issuecomment-3754263534


More information about the security-dev mailing list