• 【Python学习】python paramiko CryptographyDeprecationWarning


    import paramiko
    client = paramiko.SSHClient()
    client.connect(serverIp, port=serverPort, username=serverUser)

    报警告如下:

    paramikoecdsakey.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
    paramikokex_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())
    paramikokex_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
    paramikokex_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 2.4.2 依赖 cryptography,而最新的cryptography==2.5里有一些弃用的API。

    解决

    删掉cryptography 2.5,安装2.4.2,就不会报错了。

    pip uninstall cryptography==2.5
    pip install cryptography==2.4.2

    补充

    paramiko的issue #1369提到了这个问题,并已有PR #1379了,尚未合并。

    作者:gtea 博客地址:https://www.cnblogs.com/gtea
  • 相关阅读:
    64位Windows2008下插入Oracle中文乱码问题解决
    .net自定义WebService WSDL
    IE8下调用Active控件
    IIS7.5下发布应用程序备忘
    在aws ec2上使用root用户登录
    win2008 服务器文件夹权限配置
    thinkphp3.1 多表联合查询代码
    并发 并行 同步 异步 多线程的区别
    学习ES6生成器(Generator)
    node.js+socket.io配置详解
  • 原文地址:https://www.cnblogs.com/gtea/p/13226580.html
Copyright © 2020-2023  润新知