UnsupportedAlgorithm:此后端不支持此密钥序列化。Python加密加载\u pem_私钥

2024-03-28 15:30:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图基于示例here为AWS Cloudfront生成签名的url。在线

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

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

^{pr2}$

在阅读文档时,它表示发生异常的原因如下:

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-----结尾。在

我正在使用googleappenginesdk开发这个应用程序。在

我需要帮助理解这个错误信息和如何使它工作。在


Tags: thekeybackend示例bythatisnot
1条回答
网友
1楼 · 发布于 2024-03-28 15:30:55

不幸的是,python加密库不能与googleappengine(GAE)一起使用,因为这个库需要有C扩展,而不能在GAE中安装C扩展。您只能使用纯python包。在

相关问题 更多 >