【发布时间】:2020-04-02 05:17:31
【问题描述】:
我正在尝试使用密码学中的危险材料在 python 中生成公共/私有椭圆曲线密钥对。以下是我拥有的当前代码。当我运行时,它正在生成错误“NoneType”对象没有属性“generate_elliptic_curve_private_key”
ecurve = asymmetric.ec.EllipticCurve
ecurve.name = 'secp256r1'
ecurve.key_size = 128
ec_backend = cryptography.hazmat.backends.interfaces.EllipticCurveBackend.generate_elliptic_curve_private_key(cryptography.hazmat.backends.interfaces.EllipticCurveBackend, ecurve)
key = asymmetric.ec.generate_private_key(curve=ecurve, backend=ec_backend)
这里是文档https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ec/#
【问题讨论】:
-
EllipticCurveBackend... 这里的“后端”一词对我大喊“不要使用”。即使它运行,它也可能在第一次重写 EC 功能时崩溃。
标签: python cryptography elliptic-curve python-cryptography