You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to load a previously saved private key into a JWK instance using the JWK.load method.
The documentation (https://josepy.readthedocs.io/en/latest/api/jwk/) indicates that the load method expects a str to be passed to the data object, but whenever I do this, I'm getting an exception, resulting in the next stacktrace:
File "C:/Users/xxx/Desktop/xxx/certificate_requester.py", line 13, in __main__
key = jose.JWK.load(data=private_key)
File "C:\Users\xxx\Desktop\xxx\venv\lib\site-packages\josepy\jwk.py", line 108, in load
key = cls._load_cryptography_key(data, password, backend)
File "C:\Users\xxx\Desktop\xxx\venv\lib\site-packages\josepy\jwk.py", line 83, in _load_cryptography_key
return loader(data, backend)
File "C:\Users\xxx/\Desktop\xxx\venv\lib\site-packages\cryptography\hazmat\primitives\serialization.py", line 24, in load_pem_public_key
return backend.load_pem_public_key(data)
File "C:\Users\xxx/\Desktop\xxx\venv\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 1019, in load_pem_public_key
mem_bio = self._bytes_to_bio(data)
File "C:\Users\xxx\Desktop\xxx\venv\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 437, in _bytes_to_bio
data_char_p = self._ffi.new("char[]", data)
TypeError: initializer for ctype 'char[]' must be a bytes or list or tuple, not str
However, when I pass in a bytes object (obtained by performing an encode('ascii') on the str instance, it's working out all fine.
Could this be due to a difference between python2 and python 3? I'm using the latter.
Environment:
acme 0.21.1
josepy 1.0.1
python 3.6.3
The text was updated successfully, but these errors were encountered:
Hi,
I'm trying to load a previously saved private key into a
JWK
instance using theJWK.load
method.The documentation (https://josepy.readthedocs.io/en/latest/api/jwk/) indicates that the
load
method expects astr
to be passed to the data object, but whenever I do this, I'm getting an exception, resulting in the next stacktrace:However, when I pass in a
bytes
object (obtained by performing anencode('ascii')
on thestr
instance, it's working out all fine.Could this be due to a difference between python2 and python 3? I'm using the latter.
Environment:
The text was updated successfully, but these errors were encountered: