2016-08-31 17 views
4

我试图根据示例here为AWS Cloudfront生成已签名的URL。上线UnsupportedAlgorithm:这个后端不支持这个键序列化。 - Python加密load_pem_private_key

private_key = serialization.load_pem_private_key(
     key_file.read(), 
     password=None, 
     backend=default_backend() 
    ) 

我得到的错误UnsupportedAlgorithm: This backend does not support this key serialization.完整轨迹如下:

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. 

在阅读的文档,它说的是,发生异常是因为以下几点:

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. 

给定的PEM文件以-----BEGIN RSA PRIVATE KEY-----开头并以-----END RSA PRIVATE KEY-----结尾。

我在开发此应用程序时使用google appengine sdk。

我需要帮助了解此错误消息以及如何使其工作。

回答

2

不幸的是,python密码库不能用于谷歌appengine(GAE),因为这个库需要C扩展名,而且你不能在GAE中安装C扩展名。你只能使用纯Python包。

+1

不错,我正在跟踪这个问题。 –