This commit is contained in:
Mikhail Yankelevich 2026-01-12 11:42:57 +00:00
parent 711fa0baec
commit 8891c0f1f0
7 changed files with 36 additions and 20 deletions

View File

@ -414,13 +414,15 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
}
/**
* Returns the creation timestamp (instant) of the entry identified
* by the given alias.
* Returns the creation timestamp as an {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
*
* @return the creation instant of this entry, or null if the given
* alias does not exist
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
final Object entry = entries.get(alias.toLowerCase(Locale.ROOT));

View File

@ -222,13 +222,15 @@ public final class JceKeyStore extends KeyStoreSpi {
}
/**
* Returns the creation timestamp (instant) of the entry identified
* by the given alias.
* Returns the creation timestamp as an {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
*
* @return the creation instant of this entry, or null if the given
* alias does not exist
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
final Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));

View File

@ -1184,7 +1184,8 @@ public class KeyStore {
/**
* Returns the creation date of the entry identified by the given alias.
* <p>
* Please consider using {@code getCreationTimestamp} instead.
* This method returns a Date, which is mutable and more error-prone.
* Use getCreationTimestamp() instead.
*
* @param alias the alias name
*
@ -1205,8 +1206,8 @@ public class KeyStore {
/**
* Returns the creation timestamp (Instant) of the entry identified
* by the given alias.
* Returns the creation timestamp as an {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
*
@ -1215,6 +1216,8 @@ public class KeyStore {
*
* @throws KeyStoreException if the keystore has not been initialized
* (loaded).
*
* @since 27
*/
public final Instant getCreationTimestamp(String alias)
throws KeyStoreException

View File

@ -129,22 +129,23 @@ public abstract class KeyStoreSpi {
public abstract Date engineGetCreationDate(String alias);
/**
* Returns the creation timestamp (Instant) of the entry identified
* by the given alias.
* Returns the creation timestamp as an {@code Instant} value
* of the entry identified by the given alias.
*
* @implSpec This method simply performs
* {@code engineGetCreationDate(alias)} which returns a {@code Date}.
* If the result is not @{code null} returns
* Instance equivalent to received {@code Date}.
* @implSpec
* The default implementation calls {@code engineGetCreationDate(alias)}
* and returns the output as an {@code Instant} value.
*
* @param alias the alias name
*
* @return the creation instant of this entry, or {@code null}
* if the given alias does not exist
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
final Date date = engineGetCreationDate(alias);
return date == null? null : date.toInstant();
return date == null ? null : date.toInstant();
}
/**

View File

@ -550,13 +550,15 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
}
/**
* Returns the creation timestamp (Instant) of the entry identified
* by the given alias.
* Returns the creation timestamp as an {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
*
* @return the creation date of this entry, or null if the given alias does
* not exist
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
final Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));

View File

@ -236,13 +236,15 @@ abstract class DomainKeyStore extends KeyStoreSpi {
}
/**
* Returns the creation timestamp (instant) of the entry identified
* by the given alias.
* Returns the creation timestamp as an {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
*
* @return the creation instant of this entry, or null if the given
* alias does not exist
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {

View File

@ -237,18 +237,22 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi {
* not exist
*/
public Date engineGetCreationDate(String alias) {
return Date.from(this.engineGetCreationTimestamp(alias));
final Instant instant = this.engineGetCreationTimestamp(alias);
return instant == null ? null : Date.from(instant);
}
/**
* Returns the creation timestamp (instant) of the entry identified by the given alias.
* Returns the creation timestamp as an {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
*
* @return the creation instant of this entry, or null if the given alias does
* not exist
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
final Object entry = entries.get(convertAlias(alias));