我正在尝试使用密码学中的危险材料在 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/#