xrtSshKexExchangeInit

使用同一动态缓冲池初始化连接级 KEX 交换对象;空池使用全局分配器。

bool xrtSshKexExchangeInit( xsshkexexchange* pExchange, xnetbufpool* pPool, xsshrole Role );
参数说明
xsshkexexchange* pExchange交换对象
xnetbufpool* pPool池
xsshrole Role本地角色
返回:使用同一动态缓冲池初始化连接级 KEX 交换对象;空池使用全局分配器。

示例已编译验证

sshkexexchangeinit obj;
xrtSshKexExchangeInit(&obj, pExchange, pPool, Role);

xrtSshKexExchangeClear

释放全部 transcript 动态块,并安全清除 KEX 密钥和 SessionId。

void xrtSshKexExchangeClear(xsshkexexchange* pExchange);
参数说明
xsshkexexchange* pExchange交换对象
返回:释放全部 transcript 动态块,并安全清除 KEX 密钥和 SessionId。

示例已编译验证

/* 释放全部 transcript 动态块,并安全清除 KEX 密钥和 SessionId。 */
result = xrtSshKexExchangeClear(pExchange);

xrtSshKexExchangeVersionPrepare

XRT_API xsshcode xrtSshKexExchangeVersionPrepare( xsshkexexchange* pExchange, const xsshtransportcore* pCore, xsshtransportdirection Direction, xstrview Version );

;
返回:XRT_API xsshcode xrtSshKexExchangeVersionPrepare( xsshkexexchange* pExchange, const xsshtransportcore* pCore, xsshtransportdirection Direction, xstrview Version );

示例已编译验证

/* XRT_API xsshcode xrtSshKexExchangeVersionPrepare( xsshkexexchange* pExchange, const xsshtransportcore* pCore, xsshtransportdirection Direction, xstrview Version ); */
result = xrtSshKexExchangeVersionPrepare();

xrtSshKexExchangeVersionCommit

transport 已提交对应 identification 后,发布连接级稳定版本串。

xsshcode xrtSshKexExchangeVersionCommit( xsshkexexchange* pExchange, const xsshtransportcore* pCore );
参数说明
xsshkexexchange* pExchange交换对象
const xsshtransportcore* pCore核心对象
返回:transport 已提交对应 identification 后,发布连接级稳定版本串。

示例已编译验证

/* transport 已提交对应 identification 后,发布连接级稳定版本串。 */
result = xrtSshKexExchangeVersionCommit(pExchange, pCore);

xrtSshKexExchangeVersionAbort

transport 尚未提交对应 identification 时放弃暂存副本。

xsshcode xrtSshKexExchangeVersionAbort( xsshkexexchange* pExchange, const xsshtransportcore* pCore );
参数说明
xsshkexexchange* pExchange交换对象
const xsshtransportcore* pCore核心对象
返回:transport 尚未提交对应 identification 时放弃暂存副本。

示例已编译验证

/* transport 尚未提交对应 identification 时放弃暂存副本。 */
result = xrtSshKexExchangeVersionAbort(pExchange, pCore);

xrtSshKexExchangeKexInitPrepare

XRT_API xsshcode xrtSshKexExchangeKexInitPrepare( xsshkexexchange* pExchange, const xsshtransportcore* pCore, xsshtransportdirection Direction, xbytesview Payload );

;
返回:XRT_API xsshcode xrtSshKexExchangeKexInitPrepare( xsshkexexchange* pExchange, const xsshtransportcore* pCore, xsshtransportdirection Direction, xbytesview Payload );

示例已编译验证

sshkexexchangekexinitprepare obj;
xrtSshKexExchangeKexInitPrepare(&obj);

xrtSshKexExchangeKexInitCommit

transport 已提交同一方向和 packet 序号后,发布本代 KEXINIT。

xsshcode xrtSshKexExchangeKexInitCommit( xsshkexexchange* pExchange, const xsshtransportcore* pCore );
参数说明
xsshkexexchange* pExchange交换对象
const xsshtransportcore* pCore核心对象
返回:transport 已提交同一方向和 packet 序号后,发布本代 KEXINIT。

示例已编译验证

sshkexexchangekexinitcommit obj;
xrtSshKexExchangeKexInitCommit(&obj, pExchange, pCore);

xrtSshKexExchangeKexInitAbort

transport 状态和 packet 计数尚未推进时放弃暂存 KEXINIT。

xsshcode xrtSshKexExchangeKexInitAbort( xsshkexexchange* pExchange, const xsshtransportcore* pCore );
参数说明
xsshkexexchange* pExchange交换对象
const xsshtransportcore* pCore核心对象
返回:transport 状态和 packet 计数尚未推进时放弃暂存 KEXINIT。

示例已编译验证

sshkexexchangekexinitabort obj;
xrtSshKexExchangeKexInitAbort(&obj, pExchange, pCore);

xrtSshKexExchangeReady

判断版本串、双方 KEXINIT 与 transport 状态是否可以开始本代方法交换。

bool xrtSshKexExchangeReady( const xsshkexexchange* pExchange, const xsshtransportcore* pCore );
参数说明
const xsshkexexchange* pExchange交换对象
const xsshtransportcore* pCore核心对象
返回:判断版本串、双方 KEXINIT 与 transport 状态是否可以开始本代方法交换。

示例已编译验证

/* 判断版本串、双方 KEXINIT 与 transport 状态是否可以开始本代方法交换。 */
result = xrtSshKexExchangeReady(pExchange, pCore);

xrtSshKexExchangeTranscript

返回 READY、METHOD 或 COMPLETE 阶段的稳定 transcript 借用视图。

xsshcode xrtSshKexExchangeTranscript( xsshkexexchange* pExchange, xsshkextranscript* pTranscript );
参数说明
xsshkexexchange* pExchange交换对象
xsshkextranscript* pTranscriptTranscrt 参数
返回:返回 READY、METHOD 或 COMPLETE 阶段的稳定 transcript 借用视图。

示例已编译验证

/* 返回 READY、METHOD 或 COMPLETE 阶段的稳定 transcript 借用视图。 */
result = xrtSshKexExchangeTranscript(pExchange, pTranscript);

xrtSshKexExchangeBeginWithPrivate

使用显式 Curve25519 私钥开始本代 KEX,并在成功后晋升下一代动态缓冲。

xsshcode xrtSshKexExchangeBeginWithPrivate( xsshkexexchange* pExchange, xsshtransportcore* pCore, xbytesview ServerHostKey, xbytesview PrivateKey );
参数说明
xsshkexexchange* pExchange交换对象
xsshtransportcore* pCore核心对象
xbytesview ServerHostKeyServerHostKey 参数
xbytesview PrivateKeyPrvateKey 参数
返回:使用显式 Curve25519 私钥开始本代 KEX,并在成功后晋升下一代动态缓冲。

示例已编译验证

/* 使用显式 Curve25519 私钥开始本代 KEX,并在成功后晋升下一代动态缓冲。 */
result = xrtSshKexExchangeBeginWithPrivate(pExchange, pCore, ServerHostKey, PrivateKey);

xrtSshKexExchangeSession

返回 METHOD 或 COMPLETE 阶段可推进的 KEX 会话。

xsshkexsession* xrtSshKexExchangeSession( xsshkexexchange* pExchange );
参数说明
xsshkexexchange* pExchange交换对象
返回:返回 METHOD 或 COMPLETE 阶段可推进的 KEX 会话。

示例已编译验证

/* 返回 METHOD 或 COMPLETE 阶段可推进的 KEX 会话。 */
result = xrtSshKexExchangeSession(pExchange);

xrtSshKexExchangeSessionConst

返回 METHOD 或 COMPLETE 阶段的只读 KEX 会话。

const xsshkexsession* xrtSshKexExchangeSessionConst( const xsshkexexchange* pExchange );
参数说明
const xsshkexexchange* pExchange交换对象
返回:返回 METHOD 或 COMPLETE 阶段的只读 KEX 会话。

示例已编译验证

/* 返回 METHOD 或 COMPLETE 阶段的只读 KEX 会话。 */
result = xrtSshKexExchangeSessionConst(pExchange);

xrtSshKexExchangeComplete

确认 KEX 会话和 transport 均已完成本代双向密钥切换。

xsshcode xrtSshKexExchangeComplete( xsshkexexchange* pExchange, const xsshtransportcore* pCore );
参数说明
xsshkexexchange* pExchange交换对象
const xsshtransportcore* pCore核心对象
返回:确认 KEX 会话和 transport 均已完成本代双向密钥切换。

示例已编译验证

/* 确认 KEX 会话和 transport 均已完成本代双向密钥切换。 */
result = xrtSshKexExchangeComplete(pExchange, pCore);

xrtSshKexExchangeFail

终止交换,放弃未发布的下一代材料并清除本代临时秘密。

void xrtSshKexExchangeFail(xsshkexexchange* pExchange);
参数说明
xsshkexexchange* pExchange交换对象
返回:终止交换,放弃未发布的下一代材料并清除本代临时秘密。

示例已编译验证

/* 终止交换,放弃未发布的下一代材料并清除本代临时秘密。 */
result = xrtSshKexExchangeFail(pExchange);