Go 使用crypto/ssh连接到Cisco交换机

Go 使用crypto/ssh连接到Cisco交换机,go,ssh,Go,Ssh,我使用这段代码作为起点 使用它并将其指向cisco路由器会得到以下错误消息: 拨号失败:ssh:握手失败:ssh:没有客户端到服务器密码的通用算法;提供的客户:[aes128中心aes192中心aes256中心aes128-gcm@openssh.comarcfour256 arcfour128],提供的服务器:[aes128 cbc 3des cbc aes192 cbc aes256 cbc] 阅读了一些资料后,我了解到可以通过自定义配置来启用aes128 cbc: // CBC mode

我使用这段代码作为起点

使用它并将其指向cisco路由器会得到以下错误消息:

拨号失败:ssh:握手失败:ssh:没有客户端到服务器密码的通用算法;提供的客户:[aes128中心aes192中心aes256中心aes128-gcm@openssh.comarcfour256 arcfour128],提供的服务器:[aes128 cbc 3des cbc aes192 cbc aes256 cbc]

阅读了一些资料后,我了解到可以通过自定义配置来启用aes128 cbc:

// CBC mode is insecure and so is not included in the default config.
// (See http://www.isg.rhul.ac.uk/~kp/SandPfinal.pdf). If absolutely
// needed, it's possible to specify a custom Config to enable it.
所以我补充说:

HostKeyAlgorithms: []string{"aes128cbcID"},
到我的ssh.ClientConfig,我得到了一个不同的错误:

拨号失败:ssh:握手失败:ssh:主机密钥没有通用算法;提供的客户端:[aes128cbcID],提供的服务器:[ssh rsa]

这基本上让我认为,当我需要指定客户机到服务器的密码时,我正在指定HostKeyAlgorithm,但我找不到足够好的方法来弄清楚如何做到这一点


有什么想法吗

您需要的是在客户端的配置中设置
密码
字段。它在公共结构中,嵌入在

sshConfig.Ciphers = []string{"aes128-cbc"}