[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] JDK1.2 vs JDK1.3



The following code segment executes perfectly with JDK1.2:

iaik.x509.NetscapeCertRequest certreq = new
iaik.x509.NetscapeCertRequest(req.getBytes());
int keylen =
((iaik.security.rsa.RSAPublicKey)certreq.getPublicKey()).getModulus().bitLen
gth();

However, with JDK1.3 I get the following exception:
"java.lang.ClassCastException: com.sun.rsajca.JSA_RSAPublicKey"


I can fix the exception by modifying my code to read:

iaik.x509.NetscapeCertRequest certreq = new
iaik.x509.NetscapeCertRequest(req.getBytes());
java.security.PublicKey x =
(java.security.PublicKey)certreq.getPublicKey();
iaik.security.rsa.RSAPublicKey y = new
iaik.security.rsa.RSAPublicKey(x.getEncoded());
int keylen = y.getModulus().bitLength();


I guess this email serves mostly as information to those out there who
may be migrating from JDK1.2 to JDK1.3 unless somebody has a better
solution for me. Perhaps I am overlooking something (my guess is that
Sun changed something under the hood of their
java.security.interfaces.RSAPublicKey class). I'd prefer not to have to
change code if at all possible.


Thanks for any response,

Keith Wiseman
Digital Signature Trust co.

--
Mailinglist-archive at
http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content:
UNSUBSCRIBE iaik-jce