RE: [Jsdsi-users] KeyPair
Status: Pre-Alpha
Brought to you by:
sajma
From: Luis P. <lp...@ne...> - 2004-08-11 19:22:15
|
Marek, It help if u send the exact error. But try this: - If the error is "SPKI not found", then u have to load jsdsi provider, i.e, jsdsi.Provider.install() and cryptix provider. But, if your problem is a ClassCastException then u have an error on = your code and u should change this(following your code): java.security.KeyPair gk =3D jsdsi.util.KeyPairFactory.create("RSA", 2048); java.io.FileOutputStream fos =3D new java.io.FileOutputStream("gde/tests/test.pub"); java.io.ObjectOutputStream oos =3D new java.io.ObjectOutputStream(fos); // I have changed things here, tooked "toString()"=09 oos.writeObject(gk); // Doesn't make sense writing an object like gk.toString()!! // writeObject serializes the object. U can't cast from "String" to "KeyPair"=20 oos.close(); java.security.KeyPair gk; java.io.FileInputStream fos =3D new java.io.FileInputStream("gde/tests/test.pub"); java.io.ObjectInputStream oos =3D new java.io.ObjectInputStream(fos); gk =3D (java.security.KeyPair)oos.readObject(); oos.close(); =09 -- Lu=EDs Pedro _____________________ yahoo: lpv_pt msn: lp...@ne... =20 =BB -----Original Message----- =BB From: jsd...@li...=20 =BB [mailto:jsd...@li...] On=20 =BB Behalf Of Marek L=E1ny =BB Sent: quarta-feira, 11 de Agosto de 2004 19:16 =BB To: jsd...@li... =BB Subject: [Jsdsi-users] KeyPair =BB =20 =BB Hi =BB =20 =BB I will save and load a KeyPair, but i can't it. I trying=20 =BB with this: =BB KeyPair gk =3D = jsdsi.util.KeyPairFactory.create("RSA",2048); =BB FileOutputStream fos =3D new FileOutputStream("gk.pub"); =BB ObjectOutputStream oos =3D new ObjectOutputStream(fos); =BB oos.writeObject(gk.toString()); =BB oos.close(); =BB =20 =BB How can't I load this object and retype in a KeyPair?=20 =BB This code don't =BB work: =BB =20 =BB KeyPair gk; =BB FileInputStream fos =3D new FileInputStream("gk.pub"); =BB ObjectInputStream oos =3D new ObjectInputStream(fos); =BB gk =3D (KeyPair) oos.readObject(); =BB oos.close(); =BB =20 =BB Thanx. =BB =20 =BB Marek Lany =BB =20 =BB =20 =BB =20 =BB ------------------------------------------------------- =BB SF.Net email is sponsored by Shop4tech.com-Lowest price=20 =BB on Blank Media =BB 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only = $33 =BB Save 50% off Retail on Ink & Toner - Free Shipping and Free = Gift. =BB http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 =BB _______________________________________________ =BB Jsdsi-users mailing list =BB Jsd...@li... =BB https://lists.sourceforge.net/lists/listinfo/jsdsi-users |