gpt4 book ai didi

ssh - SSH2 算法协商数据包有效负载中的名称列表如何分开?

转载 作者:行者123 更新时间:2023-12-02 13:56:38 27 4
gpt4 key购买 nike

我在 RFC4253 中找到那:

7.1. Algorithm Negotiation

Key exchange begins by each side sending the following packet:

  byte         SSH_MSG_KEXINIT
byte[16] cookie (random bytes)
name-list kex_algorithms
name-list server_host_key_algorithms
name-list encryption_algorithms_client_to_server
name-list encryption_algorithms_server_to_client
name-list mac_algorithms_client_to_server
name-list mac_algorithms_server_to_client
name-list compression_algorithms_client_to_server
name-list compression_algorithms_server_to_client
name-list languages_client_to_server
name-list languages_server_to_client
boolean first_kex_packet_follows
uint32 0 (reserved for future extension)

Each of the algorithm name-lists MUST be a comma-separated list ofalgorithm names (see Algorithm Naming in [SSH-ARCH] and additional
information in [SSH-NUMBERS]). Each supported (allowed) algorithm
MUST be listed in order of preference, from most to least.


但是我在 RFC 中找不到关于如何在有效负载中分隔名称列表的信息。
编辑:
全部通过 DataInputStream 解决, 使用方便的方法 readByte(byte[] b, int off, int len) , readInt()readBoolean() .

最佳答案

正如 RFC 所述,SSH-ARCH 中有更多信息。这是RFC 4251 .以下是 name-list 的部分摘录被定义为:

A string containing a comma-separated list of names. A name-list isrepresented as a uint32 containing its length (number of bytes thatfollow) followed by a comma-separated list of zero or more names.


因此,在您读取了 key 交换数据包的前 17 个字节后,您将需要读取 4 个字节,这将告诉您需要读取多少字节(它是 ASCII 编码的,因此每个字符 1 个字节)以消耗其余部分 name-list .然后为每个后续列表重复此过程。

关于ssh - SSH2 算法协商数据包有效负载中的名称列表如何分开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29698964/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com