UnsupportedAlgorithm:这个后端不支持这个键序列化。 - Python加密load_pem_private_key [英] UnsupportedAlgorithm: This backend does not support this key serialization. - Python cryptography load_pem_private_key

查看:1078
本文介绍了UnsupportedAlgorithm:这个后端不支持这个键序列化。 - Python加密load_pem_private_key的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图根据示例此处。在线上

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()
    )

c $ c> UnsupportedAlgorithm:这个后端不支持这个键序列化。完整的跟踪如下:

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.

给定的PEM文件以开头 - BEGIN RSA PRIVATE KEY ----- 结束于 ----- END RSA PRIVATE KEY -----

The PEM file given starts with -----BEGIN RSA PRIVATE KEY----- and ends with -----END RSA PRIVATE KEY----- .

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

I am using google appengine sdk while developing this application.

我需要帮助了解此错误消息以及

I need help understanding this error message and how to make this work.

推荐答案

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

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.

这篇关于UnsupportedAlgorithm:这个后端不支持这个键序列化。 - Python加密load_pem_private_key的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆