Python 使用 paramiko CryptographyDeprecationWarning 报警处理

报警内容如下

1
2
3
4
5
6
7
8
paramiko\ecdsakey.py:164: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
self.ecdsa_curve.curve_class(), pointinfo
paramiko\kex_ecdh_nist.py:39: 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.
m.add_string(self.Q_C.public_numbers().encode_point())
paramiko\kex_ecdh_nist.py:96: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
self.curve, Q_S_bytes
paramiko\kex_ecdh_nist.py:111: 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.
hm.add_string(self.Q_C.public_numbers().encode_point())

原因

paramiko 依赖的cryptography,在新的版本中有一些API被弃用了

解决方法

1
2
pip uninstall cryptography==2.5
pip install cryptography==2.4.2
坚持原创技术分享,您的支持将鼓励我继续创作!
  • 本文标题:: Python 使用 paramiko CryptographyDeprecationWarning 报警处理
  • 本文作者: 臭臭
  • 本文链接: https://www.ruyione.com/2019/03/05/045/
  • 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!