RFR: 8225181: KeyStore should have a getAttributes method [v3]

Sean Mullan mullan at openjdk.java.net
Thu Nov 4 13:24:16 UTC 2021


On Wed, 3 Nov 2021 14:18:38 GMT, Weijun Wang <weijun 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.
>
> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   more clear and precise spec

src/java.base/share/classes/java/security/KeyStore.java line 1027:

> 1025:      *
> 1026:      * @implSpec
> 1027:      * The default implementation returns an empty {@code Set}.

Would it make more sense for the default impl to throw `UnsupportedOperationException` or maybe call `getEntry(alias, null)`? Otherwise, an application cannot know the difference between an alias that has no attributes and an alias that has attributes but is from a `KeyStore` impl that has not overridden the corresponding Spi method.

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

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



More information about the security-dev mailing list