xrtSshKexInitConfigInit

按 endpoint 角色和首次/重协商阶段初始化安全默认清单。

bool xrtSshKexInitConfigInit( xsshkexinitconfig* pConfig, xsshrole Role, bool bInitial );
参数说明
xsshkexinitconfig* pConfig配置结构
xsshrole Role本地角色
bool bInitialbIntal 参数
返回:按 endpoint 角色和首次/重协商阶段初始化安全默认清单。

示例已编译验证

sshkexinitconfiginit obj;
xrtSshKexInitConfigInit(&obj, Role, bInitial);

xrtSshKexInitWrite

使用调用方提供的十六字节 cookie 构建完整 KEXINIT payload。

xsshcode xrtSshKexInitWrite( xsshwriter* pWriter, xbytesview Cookie, const xsshkexinitconfig* pConfig );
参数说明
xsshwriter* pWriter写入器
xbytesview CookieCookie 文本
const xsshkexinitconfig* pConfig配置结构
返回:使用调用方提供的十六字节 cookie 构建完整 KEXINIT payload。

示例已编译验证

sshkexinitwrite obj;
xrtSshKexInitWrite(&obj, pWriter, Cookie);

xrtSshKexInitRead

解析一个完整 KEXINIT payload,并拒绝保留字段或尾随数据。

xsshcode xrtSshKexInitRead( xbytesview Payload, xsshkexinit* pKexInit );
参数说明
xbytesview Payload负载
xsshkexinit* pKexInitKexInt 参数
返回:解析一个完整 KEXINIT payload,并拒绝保留字段或尾随数据。

示例已编译验证

sshkexinitread obj;
xrtSshKexInitRead(&obj, Payload, pKexInit);

xrtSshKexNegotiate

按 RFC 4253 客户端优先级协商双向算法。

xsshcode xrtSshKexNegotiate( const xsshkexinit* pClient, const xsshkexinit* pServer, xsshkexnegotiation* pNegotiation );
参数说明
const xsshkexinit* pClient客户端对象
const xsshkexinit* pServer服务端对象
xsshkexnegotiation* pNegotiationNegotaton 参数
返回:按 RFC 4253 客户端优先级协商双向算法。

示例已编译验证

/* 按 RFC 4253 客户端优先级协商双向算法。 */
result = xrtSshKexNegotiate(pClient, pServer, pNegotiation);

xrtSshKexFeatures

根据双方 KEXINIT 判定 EXT_INFO 方向和 strict-kex 是否启用。

xsshcode xrtSshKexFeatures( const xsshkexinit* pLocal, const xsshkexinit* pPeer, xsshrole Role, bool bInitial, xsshkexfeatures* pFeatures );
参数说明
const xsshkexinit* pLocal本地地址
const xsshkexinit* pPeer对端公钥
xsshrole Role本地角色
bool bInitialbIntal 参数
xsshkexfeatures* pFeaturesFeatures 参数
返回:根据双方 KEXINIT 判定 EXT_INFO 方向和 strict-kex 是否启用。

示例已编译验证

/* 根据双方 KEXINIT 判定 EXT_INFO 方向和 strict-kex 是否启用。 */
result = xrtSshKexFeatures(pLocal, pPeer, Role, bInitial, pFeatures);

xrtSshCipherIsAead

判断已知 cipher 是否自带认证而不消费协商出的 MAC。

bool xrtSshCipherIsAead(xstrview Cipher);
参数说明
xstrview Cipher密码套件
返回:判断已知 cipher 是否自带认证而不消费协商出的 MAC。

示例已编译验证

/* 判断已知 cipher 是否自带认证而不消费协商出的 MAC。 */
result = xrtSshCipherIsAead(Cipher);

xrtSshKexGuessSkip

判断 peer 的 first_kex_packet_follows 猜测包是否必须丢弃。

xsshcode xrtSshKexGuessSkip( const xsshkexinit* pPeer, const xsshkexnegotiation* pNegotiation, bool* pSkip );
参数说明
const xsshkexinit* pPeer对端公钥
const xsshkexnegotiation* pNegotiationNegotaton 参数
bool* pSkipSk 参数
返回:判断 peer 的 first_kex_packet_follows 猜测包是否必须丢弃。

示例已编译验证

/* 判断 peer 的 first_kex_packet_follows 猜测包是否必须丢弃。 */
result = xrtSshKexGuessSkip(pPeer, pNegotiation, pSkip);