xrtSshKnownHostHash
计算 OpenSSH hashed-host 使用的 HMAC-SHA1;Salt 必须为 20 字节。
xsshcode xrtSshKnownHostHash( xstrview Host, uint32 iPort, xbytesview Salt, void* pHash );
| 参数 | 说明 |
|---|---|
| xstrview Host | 主机名 |
| uint32 iPort | 端口号 |
| xbytesview Salt | 盐值 |
| void* pHash | 哈希回调 |
返回:计算 OpenSSH hashed-host 使用的 HMAC-SHA1;Salt 必须为 20 字节。
示例已编译验证
/* 计算 OpenSSH hashed-host 使用的 HMAC-SHA1;Salt 必须为 20 字节。 */ result = xrtSshKnownHostHash(Host, iPort, Salt, pHash);
xrtSshKnownHostHashWrite
XRT_API xsshcode xrtSshKnownHostHashWrite( xstrview Host, uint32 iPort, xbytesview Salt, char* sOutput, size_t iCapacity, size_t* pOutputSize );
;
返回:XRT_API xsshcode xrtSshKnownHostHashWrite( xstrview Host, uint32 iPort, xbytesview Salt, char* sOutput, size_t iCapacity, size_t* pOutputSize );
示例已编译验证
/* XRT_API xsshcode xrtSshKnownHostHashWrite( xstrview Host, uint32 iPort, xbytesview Salt, char* sOutput, size_t iCapacity, size_t* pOutputSize ); */ result = xrtSshKnownHostHashWrite();
xrtSshKnownHostHashMatch
常量时间校验一个完整 OpenSSH |1| hashed-host token。
xsshcode xrtSshKnownHostHashMatch( xstrview HashedHost, xstrview Host, uint32 iPort, bool* pMatch );
| 参数 | 说明 |
|---|---|
| xstrview HashedHost | HashedHost 参数 |
| xstrview Host | 主机名 |
| uint32 iPort | 端口号 |
| bool* pMatch | 出:匹配详情 |
返回:常量时间校验一个完整 OpenSSH |1| hashed-host token。
示例已编译验证
/* 常量时间校验一个完整 OpenSSH |1| hashed-host token。 */ result = xrtSshKnownHostHashMatch(HashedHost, Host, iPort, pMatch);
xrtSshKnownHostLineHashMatch
对已解析且 Hashed 的 known_hosts 行执行便利匹配。
xsshcode xrtSshKnownHostLineHashMatch( const xsshknownhostline* pKnownHost, xstrview Host, uint32 iPort, bool* pMatch );
| 参数 | 说明 |
|---|---|
| const xsshknownhostline* pKnownHost | KnownHost 参数 |
| xstrview Host | 主机名 |
| uint32 iPort | 端口号 |
| bool* pMatch | 出:匹配详情 |
返回:对已解析且 Hashed 的 known_hosts 行执行便利匹配。
示例已编译验证
/* 对已解析且 Hashed 的 known_hosts 行执行便利匹配。 */ result = xrtSshKnownHostLineHashMatch(pKnownHost, Host, iPort, pMatch);