Python cryptography.x509后端参数,是否需要?

问题描述

我正在使用Python cryptography.x509读取客户端证书。

文档herebackend参数为optional

Parameters: 

    data (bytes) – The PEM encoded certificate data.
    backend – An optional backend supporting the X509Backend interface.

但是,当我尝试加载pem文件时,它无法说明需要backend属性

enter image description here

在这里想念什么?

EDIT1:

  • 我看到的用于加密的最新版本是3.1.1:

enter image description here

  • 安装3.1.1后,由于某种原因,我只能使用2.8:

enter image description here

  • 在此笔记本中,我正在使用Python 3.8 ...该如何解决

enter image description here

** EDIT2:安装3.1.1之后,我只需要关闭并重新打开笔记本即可!

  • 现在backend参数是可选的。

解决方法

您似乎正在使用旧版本。从版本3.1开始,检查changelog-backend是可选的。 (2020-08-26)

backend函数的参数不再需要,并且默认 如果没有提供后端,则会自动选择后端。

当前版本为3.1.1。 (编辑:3.2版仍在developmnet中)