xrtSshRekeyPolicyInit
初始化 RFC 4253/4344 对应的保守默认策略。
void xrtSshRekeyPolicyInit(xsshrekeypolicy* pPolicy);
| 参数 | 说明 |
|---|---|
| xsshrekeypolicy* pPolicy | 策略 |
返回:初始化 RFC 4253/4344 对应的保守默认策略。
示例已编译验证
sshrekeypolicyinit obj; xrtSshRekeyPolicyInit(&obj, pPolicy);
xrtSshRekeyInit
校验策略并初始化一代密钥的计数状态。
bool xrtSshRekeyInit( xsshrekeystate* pState, const xsshrekeypolicy* pPolicy, uint64 iNowMs );
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
| const xsshrekeypolicy* pPolicy | 策略 |
| uint64 iNowMs | 当前毫秒时间 |
返回:校验策略并初始化一代密钥的计数状态。
示例已编译验证
sshrekeyinit obj; xrtSshRekeyInit(&obj, pState, pPolicy, iNowMs);
xrtSshRekeyReset
同时清空双向计数并开始新一代,适用于两方向具有同一提交边界的驱动。
bool xrtSshRekeyReset( xsshrekeystate* pState, uint64 iNowMs );
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
| uint64 iNowMs | 当前毫秒时间 |
返回:同时清空双向计数并开始新一代,适用于两方向具有同一提交边界的驱动。
示例已编译验证
/* 同时清空双向计数并开始新一代,适用于两方向具有同一提交边界的驱动。 */ result = xrtSshRekeyReset(pState, iNowMs);
xrtSshRekeyResetSend
写密钥生效后只清空发送方向计数和时间。
bool xrtSshRekeyResetSend( xsshrekeystate* pState, uint64 iNowMs );
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
| uint64 iNowMs | 当前毫秒时间 |
返回:写密钥生效后只清空发送方向计数和时间。
示例已编译验证
/* 写密钥生效后只清空发送方向计数和时间。 */ result = xrtSshRekeyResetSend(pState, iNowMs);
xrtSshRekeyResetReceive
读密钥生效后只清空接收方向计数和时间。
bool xrtSshRekeyResetReceive( xsshrekeystate* pState, uint64 iNowMs );
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
| uint64 iNowMs | 当前毫秒时间 |
返回:读密钥生效后只清空接收方向计数和时间。
示例已编译验证
/* 读密钥生效后只清空接收方向计数和时间。 */ result = xrtSshRekeyResetReceive(pState, iNowMs);
xrtSshRekeyComplete
双向新密钥均已生效后结束主动 rekey 请求,不修改新代计数。
bool xrtSshRekeyComplete(xsshrekeystate* pState);
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
返回:双向新密钥均已生效后结束主动 rekey 请求,不修改新代计数。
示例已编译验证
/* 双向新密钥均已生效后结束主动 rekey 请求,不修改新代计数。 */ result = xrtSshRekeyComplete(pState);
xrtSshRekeyRequest
请求策略阈值之外的主动 rekey。
bool xrtSshRekeyRequest(xsshrekeystate* pState);
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
返回:请求策略阈值之外的主动 rekey。
示例已编译验证
/* 请求策略阈值之外的主动 rekey。 */ result = xrtSshRekeyRequest(pState);
xrtSshRekeyCheck
查询当前计数、主动请求和时间阈值产生的决策。
xsshcode xrtSshRekeyCheck( const xsshrekeystate* pState, uint64 iNowMs, xsshrekeydecision* pDecision );
| 参数 | 说明 |
|---|---|
| const xsshrekeystate* pState | 状态对象 |
| uint64 iNowMs | 当前毫秒时间 |
| xsshrekeydecision* pDecision | Decson 参数 |
返回:查询当前计数、主动请求和时间阈值产生的决策。
示例已编译验证
/* 查询当前计数、主动请求和时间阈值产生的决策。 */ result = xrtSshRekeyCheck(pState, iNowMs, pDecision);
xrtSshRekeyReserveSend
在发送前预留下一包;REQUIRED 时状态不变且该包不得发送。
xsshcode xrtSshRekeyReserveSend( xsshrekeystate* pState, uint64 iWireBytes, uint64 iCipherBlocks, uint64 iNowMs, xsshrekeydecision* pDecision );
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
| uint64 iWireBytes | WreBytes 参数 |
| uint64 iCipherBlocks | CherBlocks 参数 |
| uint64 iNowMs | 当前毫秒时间 |
| xsshrekeydecision* pDecision | Decson 参数 |
返回:在发送前预留下一包;REQUIRED 时状态不变且该包不得发送。
示例已编译验证
/* 在发送前预留下一包;REQUIRED 时状态不变且该包不得发送。 */ result = xrtSshRekeyReserveSend(pState, iWireBytes, iCipherBlocks, iNowMs, pDecision);
xrtSshRekeyReserveReceive
在认证接收包前预留下一包;REQUIRED 时状态不变且该包不得接受。
xsshcode xrtSshRekeyReserveReceive( xsshrekeystate* pState, uint64 iWireBytes, uint64 iCipherBlocks, uint64 iNowMs, xsshrekeydecision* pDecision );
| 参数 | 说明 |
|---|---|
| xsshrekeystate* pState | 状态对象 |
| uint64 iWireBytes | WreBytes 参数 |
| uint64 iCipherBlocks | CherBlocks 参数 |
| uint64 iNowMs | 当前毫秒时间 |
| xsshrekeydecision* pDecision | Decson 参数 |
返回:在认证接收包前预留下一包;REQUIRED 时状态不变且该包不得接受。
示例已编译验证
/* 在认证接收包前预留下一包;REQUIRED 时状态不变且该包不得接受。 */ result = xrtSshRekeyReserveReceive(pState, iWireBytes, iCipherBlocks, iNowMs, pDecision);