error when import private key in python

Thomas Jollans tjol at tjol.eu
Sun Jun 4 07:28:42 EDT 2017


On 04/06/17 13:22, Ho Yeung Lee wrote:
> # [snip]
> alice_privkey=text_file.read().replace('\n', '')

Why are you removing newlines? Does the documentation tell you to do this?

>>>> privkey = RSA.importKey(alice_privkey,passphrase="mysecret")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Python27\lib\site-packages\Crypto\PublicKey\RSA.py", line 638, in importKey
>     if lines[1].startswith(b('Proc-Type:4,ENCRYPTED')):
> IndexError: list index out of range
> 

This is just a wild guess, but it looks like the package expects there
to be multiple lines in the key.


-- Thomas



More information about the Python-list mailing list