tags:

views:

124

answers:

1

Hi,

RSA.gen_key function always asks for password when it's used to generate keys. Is there a way to feed it the password from the python code instead of typing it manually?

Thanks,

-R

A: 

It does not ask for passwords as far as I know:

In [1]: from M2Crypto import RSA

In [2]: r=RSA.gen_key(1024, 65537)
..++++++
.......................................++++++

In [3]: 

If you don't like that output, you can provide a custom callback function. See documentation and tests.

If you mean that it asks for passphrase when calling save_pem() method, you are right: the default will ask for password. But again, you can provide your own callback that provides the password programmatically.

Heikki Toivonen