I am trying to generate signed urls for AWS Cloudfront based on the example here. On the line
private_key = serialization.load_pem_private_key(
key_file.read(),
password=None,
backend=default_backend()
)
I get the error UnsupportedAlgorithm: This backend does not support this key serialization.
The full trace is as below:
File "command_util.py", line 98, in rsa_signer
backend=default_backend()
File "runtime/cryptography/hazmat/primitives/serialization.py", line 20, in load_pem_private_key
return backend.load_pem_private_key(data, password)
File "runtime/cryptography/hazmat/backends/multibackend.py", line 286, in load_pem_private_key
_Reasons.UNSUPPORTED_SERIALIZATION
UnsupportedAlgorithm: This backend does not support this key serialization.
On reading the docs it says that the exception occurs because of the following:
cryptography.exceptions.UnsupportedAlgorithm – the serialized key is of a type that is not supported by the backend or if
the key is encrypted with a symmetric cipher that is not supported by the backend.
The PEM file given starts with -----BEGIN RSA PRIVATE KEY-----
and ends with -----END RSA PRIVATE KEY-----
.
I am using google appengine sdk while developing this application.
I need help understanding this error message and how to make this work.
Unfortunately the python cryptography library cannot be used with google appengine(GAE) as this library needs to have C extensions and you cannot install C extensions in GAE. You can only use pure python packages.