我正在尝试使用 Python 脚本连接 SFTP。由于“p 错误”,我无法连接。
import paramiko
client = paramiko.SSHClient()
client.load_system_host_keys()
client.connect('####.com', username='####', password='###')
stdin, stdout, stderr = client.exec_command('ls -l')
Error:
ValueError:p 的长度必须恰好为 1024、2048 或 3072 位
求出 的值p
并包括计算出的p
in dsa.py
文件并保存。
如何计算P:
def _check_dsa_parameters(parameters):
print(parameters.p.bit_length(),"value of p")
if parameters.p.bit_length() not in [1024, 2048, 3024]:
将 p 包含在此列表中:
(if parameters.p.bit_length() not in [1024, 2048, p-value]:)
修改后:
def _check_dsa_parameters(parameters):
if parameters.p.bit_length() not in [1024, 2048, p-value]:
raise ValueError("p must be exactly 1024, 2048, or 3072 bits long")
进行整改后效果很好。
谢谢
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)