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

Sibabrata Sahoo ssahoo at openjdk.java.net
Fri Apr 16 07:43:35 UTC 2021


On Thu, 15 Apr 2021 18:32:26 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> test/jdk/javax/crypto/KeyGenerator/CompareKeys.java line 73:
>> 
>>> 71:                 && !Arrays.equals(origKey.getEncoded(), copyKey.getEncoded())
>>> 72:                 && origKey.hashCode() != copyKey.hashCode()) {
>>> 73:             throw new RuntimeException("Key inequality found");
>> 
>> Check the format equality as well?
>
> Should be || instead of &&? Would also be nice to know which one(s) failed.

Considering equality and hashCode check may not be same for all KeyTypes, i have relaxed the verification with || operator. Also added print statement for possible failure cause. Added verification for format too.

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

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



More information about the security-dev mailing list