Actually my problem is a little different. I have a .pem format file which
contain my public and private key both and i want to get only the public key
from that file as a string.

I already have done that by just parsing the said file but if there is some
direct way i will b glad to know.

@marco i don't have the string at all. Infact i want the string
@Toivonen i tried as_pem but it gives me some private key after doing some
thing with the file i pass to it as argument which is even not the private
key i have in my file. Also if i set cipher=None, even then its result is
same

Thanks by the way marco and Toivonen for trying to help :)

On Mon, Sep 15, 2008 at 1:06 PM, Marco Bizzarri <[EMAIL PROTECTED]>wrote:

> On Mon, Sep 15, 2008 at 8:23 AM, Usman Ajmal <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I have a M2Crypto.RSA.RSA instance that contain my public-key. I want
> that
> > key as string. Is there any way to convert the said instance into string?
>
>
> In case you want to write the pub-key to a file, you can use save_pub_key
>
>    def save_pub_key(self, file):
>        """
>        Save the public key to a file in PEM format.
>
>        @type file: string
>        @param file: Name of file to save key to.
>        """
>
> Regards
> Marco
> --
> Marco Bizzarri
> http://notenotturne.blogspot.com/
> http://iliveinpisa.blogspot.com/
>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to