xrtSshKexInitConfigInit
按 endpoint 角色和首次/重协商阶段初始化安全默认清单。
bool xrtSshKexInitConfigInit( xsshkexinitconfig* pConfig, xsshrole Role, bool bInitial );
| 参数 | 说明 |
|---|---|
| xsshkexinitconfig* pConfig | 配置结构 |
| xsshrole Role | 本地角色 |
| bool bInitial | bIntal 参数 |
返回:按 endpoint 角色和首次/重协商阶段初始化安全默认清单。
示例已编译验证
sshkexinitconfiginit obj; xrtSshKexInitConfigInit(&obj, Role, bInitial);
xrtSshKexInitWrite
使用调用方提供的十六字节 cookie 构建完整 KEXINIT payload。
xsshcode xrtSshKexInitWrite( xsshwriter* pWriter, xbytesview Cookie, const xsshkexinitconfig* pConfig );
| 参数 | 说明 |
|---|---|
| xsshwriter* pWriter | 写入器 |
| xbytesview Cookie | Cookie 文本 |
| const xsshkexinitconfig* pConfig | 配置结构 |
返回:使用调用方提供的十六字节 cookie 构建完整 KEXINIT payload。
示例已编译验证
sshkexinitwrite obj; xrtSshKexInitWrite(&obj, pWriter, Cookie);
xrtSshKexInitRead
解析一个完整 KEXINIT payload,并拒绝保留字段或尾随数据。
xsshcode xrtSshKexInitRead( xbytesview Payload, xsshkexinit* pKexInit );
| 参数 | 说明 |
|---|---|
| xbytesview Payload | 负载 |
| xsshkexinit* pKexInit | KexInt 参数 |
返回:解析一个完整 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* pNegotiation | Negotaton 参数 |
返回:按 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 bInitial | bIntal 参数 |
| xsshkexfeatures* pFeatures | Features 参数 |
返回:根据双方 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* pNegotiation | Negotaton 参数 |
| bool* pSkip | Sk 参数 |
返回:判断 peer 的 first_kex_packet_follows 猜测包是否必须丢弃。
示例已编译验证
/* 判断 peer 的 first_kex_packet_follows 猜测包是否必须丢弃。 */ result = xrtSshKexGuessSkip(pPeer, pNegotiation, pSkip);