How to silence EllipticCurvePublicNumbers.encode_p

2020-02-06 06:31发布

问题:

CryptographyDeprecationWarning:

encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.

回答1:

This has been fixed in Paramiko 2.5.0 already:
https://www.paramiko.org/changelog.html#2.5.0
https://github.com/paramiko/paramiko/pull/1379
https://github.com/paramiko/paramiko/issues/1369



回答2:

I've had better success with:

import warnings
warnings.simplefilter("ignore", cryptography.utils.DeprecatedIn23)