Bug 28212 - SecretKeySpec equal method does not check the object type
Summary: SecretKeySpec equal method does not check the object type
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: crypto (show other bugs)
Version: 0.92
: P3 normal
Target Milestone: 0.92
Assignee: Casey Marshall
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-30 19:18 UTC by Matt Wringe
Modified: 2006-07-17 20:24 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Mauve testlet to PR28212 (1.13 KB, patch)
2006-07-05 19:34 UTC, Matt Wringe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Wringe 2006-06-30 19:18:52 UTC
javax.crypto.spec.SecretKeyFactory equals(Object o) does not check the object type. As such, if an object of a class other than SecretKeyFactory is passed, a ClasscastException will occur instead of returning null.
Comment 1 Matt Wringe 2006-06-30 19:38:34 UTC
A patch that solves this issue can be found here:
http://developer.classpath.org/pipermail/classpath-patches/attachments/20060630/4dba50c0/Crypto-SecretKeySpec.bin

This patch first checks if the object passed is an instance of SecretKeySpec. If the object is not an instance, then false is returned, else the rest of the comparions proceed.
Comment 2 Raif S. Naffah 2006-07-01 00:49:16 UTC
could you provide a Mauve testlet to show the bug and validate the fix please.
Comment 3 Matt Wringe 2006-07-05 19:34:54 UTC
Created attachment 11837 [details]
Mauve testlet to PR28212

This testlet is in relation to PR28212. This test verifies the bug in which if an object type other than SecretKeySpec is passed in the equals method will incorrectly throw a ClassCastException instead of returning false.

This testlet should be placed in gnu/testlet/javax/crypto/spec

The patch within the bug report will correct this issue and allow the testlet to correctly pass. http://developer.classpath.org/pipermail/classpath-patches/attachments/20060630/4dba50c0/Crypto-SecretKeySpec.bin
Comment 4 Tom Tromey 2006-07-17 20:24:15 UTC
Fix checked in.