Paramiko /加密技术弃用警告:CryptographyDeprecationWarning:EllipticCurvePublicNumbers弃用了encode_point

时间:2019-03-04 07:29:26

标签: python python-2.7 ssh cryptography paramiko

在进行简单的SSH连接时,我不断收到以下弃用警告:

2019-03-04 02:21:14 [transport] INFO : Connected (version 2.0, client OpenSSH_7.4)
/usr/local/lib/python2.7/site-packages/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())
/usr/local/lib/python2.7/site-packages/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
/usr/local/lib/python2.7/site-packages/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())
2019-03-04 02:21:14 [transport] INFO : 
   Authentication (keyboard-interactive) successful!

当程序成功运行时,关于如何消除这些消息的任何想法更令人烦恼?

我正在将Paramiko 2.4.2与Python 2.7.9结合使用

1 个答案:

答案 0 :(得分:8)

此问题已在Paramiko中修复:
https://github.com/paramiko/paramiko/issues/1369
https://github.com/paramiko/paramiko/pull/1379
修复该补丁的漏洞尚未发布。

与此同时,您可以workaround it by downgrading cryptography

pip install cryptography==2.4.2