-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hi.
If I try to load a key with the following code:
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
serialization.load_pem_private_key('test30.key', 'licupitinguanniancoffmat', default_backend())
I got the following error:
TypeError: initializer for ctype 'char[]' must be a bytes or list or tuple, not str
If I try with:
serialization.load_pem_private_key(open('test30.key', 'rb'), 'licupitinguanniancoffmat', default_backend())
I got:
TypeError: '_io.BufferedReader' object cannot be interpreted as an integer
If I try with:
serialization.load_pem_private_key(open('test30.key', 'rb').read(), 'licupitinguanniancoffmat', default_backend())
I got:
From cffi callback <function _pem_password_cb at 0x7f2f84e910d0>:
Traceback (most recent call last):
File "/usr/local/virtualenv/syseye/lib/python3.4/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 676, in _pem_password_cb
pw_buf[:len(ud.password)] = ud.password
TypeError: expected an object with a buffer interface
Could you please explain me how to import a private key?
Thanks,
Giovanni
test30.zip