RFR: 8225181: KeyStore should have a getAttributes method

Weijun Wang weijun at openjdk.java.net
Tue Oct 26 15:45:13 UTC 2021


On Mon, 25 Oct 2021 14:36:58 GMT, Sean Mullan <mullan at openjdk.org> wrote:

>> Add `KeyStore::getAttributes` so that one can get the attributes of an entry without retrieving the entry first. This is especially useful for a private key entry which can only be retrieved with a password.
>
> src/java.base/share/classes/java/security/KeyStore.java line 1038:
> 
>> 1036:      * @throws    KeyStoreException if the keystore has not been initialized
>> 1037:      * (loaded).
>> 1038:      *
> 
> throw NPE if alias is null?

OK.

> src/java.base/share/classes/java/security/KeyStoreSpi.java line 457:
> 
>> 455:      */
>> 456:     public Set<Entry.Attribute> engineGetAttributes(String alias) {
>> 457:         return Collections.emptySet();
> 
> Would `Set.of()` be better here?

Both returns an internal constant object and I think they are similar. I was copying the default implementation of `Entry::getAttributes`.

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

PR: https://git.openjdk.java.net/jdk/pull/6026



More information about the security-dev mailing list