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

Re: [iaik-jce] Save PublicKey in a File



encode() is a protected method!!!

you can use getEncoded() method inherited from class
iaik.x509.PublicKeyInfo.

Henrik Helleberg wrote:

> hello ,
>
> I want to save a Public Key in a file ..
>
> --------------------------------------------------------------------------
------
> RSAPrivateKey rsa_priv = (RSAPrivateKey)key_pair.getPrivate();
> RSAPublicKey rsa_pub = (RSAPublicKey)key_pair.getPublic();
>
>  // #################### save PublicKey in File ####################
>         byte [] rsa_pub_key = rsa_pub.encode();
>         FileOutputStream pubfos = new
FileOutputStream("C:\\...\\rsapubKey.txt");
>         pubfos.write(rsa_pub_key);
>
>         pubfos.close();
> --------------------------------------------------------------------------
---------------------------
>
> and the following error occurs : "method encode() not found in class
iaik.security.rsa.RSAPublicKey"
> But the method encode() exist !
>
> Ok, saving key pairs in a Keystore is better, but this is only for test
purpose.
>
> regards
> henrik
>
> --
> 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
>

--
Petruzzi Francesco - Openfor s.r.l.
--
via Faravelli, 8 - 20149 Milano (Italy)
phone:(+39)0234534545 - fax:(+39)0234534065
--


--
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