RFR: 8185127: Add tests to cover hashCode() method for java supported crypto key types [v2]

Valerie Peng valeriep at openjdk.java.net
Wed Apr 21 00:22:17 UTC 2021


On Fri, 16 Apr 2021 07:32:08 GMT, Sibabrata Sahoo <ssahoo at openjdk.org> wrote:

>> test/jdk/javax/crypto/KeyGenerator/CompareKeys.java line 114:
>> 
>>> 112:         HmacSHA384("HmacSHA384"),
>>> 113:         HmacSHA512("HmacSHA512"),
>>> 114:         RC2("RC2");
>> 
>> Just curious, how are these decided? Should this be an exhaustive list or just enough sampling for code coverage? If this is meant to be a general test, have you tried to not hardcoding the algorithm names to be enum? Otherwise, new algorithms will not be tested if not updating this test.
>
> Done. Key(pair)Generator list will be collected dynamically. In fact it will now test even the same algorithm names supported by different providers too instead finding the 1st one.

Sounds good.

>> test/jdk/javax/crypto/KeyGenerator/CompareKeys.java line 124:
>> 
>>> 122:         public SecretKey genSecretKey() throws Exception {
>>> 123:             KeyGenerator kg = KeyGenerator.getInstance(this.algoName);
>>> 124:             return kg.generateKey();
>> 
>> Would be informative to print out which provider is tested, i.e. where this kg is from. Same goes for KeyPairGenerator.
>
> Added print statement for KeyGenerator and corresponding Provider.

Great, thanks.

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

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


More information about the security-dev mailing list