xrtHttpAuthToken68Valid

判断完整 token68;等号只允许末尾填充,谓词不修改线程错误。

bool xrtHttpAuthToken68Valid(xstrview Text);
参数说明
xstrview Text文本视图
返回:判断完整 token68;等号只允许末尾填充,谓词不修改线程错误。

示例已编译验证

/* 判断完整 token68;等号只允许末尾填充,谓词不修改线程错误。 */
result = xrtHttpAuthToken68Valid(Text);

xrtHttpAuthParamNext

读取 auth-param;输出可未对齐,无值或语法错误不推进游标并清空结果。

xhttpnext xrtHttpAuthParamNext( xstrview Parameters, size_t* pOffset, xhttpparam* pParam );
参数说明
xstrview Parameters参数列表
size_t* pOffset出:偏移
xhttpparam* pParam参数
返回:读取 auth-param;输出可未对齐,无值或语法错误不推进游标并清空结果。

示例已编译验证

/* 读取 auth-param;输出可未对齐,无值或语法错误不推进游标并清空结果。 */
result = xrtHttpAuthParamNext(Parameters, pOffset, pParam);

xrtHttpChallengeNext

迭代认证 challenge 列表;游标和结果可未对齐,错误不推进游标。

xhttpnext xrtHttpChallengeNext( xstrview Challenges, size_t* pOffset, xhttpauth* pChallenge );
参数说明
xstrview Challenges挑战列表
size_t* pOffset出:偏移
xhttpauth* pChallenge挑战
返回:迭代认证 challenge 列表;游标和结果可未对齐,错误不推进游标。

示例已编译验证

/* 迭代认证 challenge 列表;游标和结果可未对齐,错误不推进游标。 */
result = xrtHttpChallengeNext(Challenges, pOffset, pChallenge);

xrtHttpAuthCursorInit

把 challenge 游标重置到字段列表起点;输出可未对齐。

void xrtHttpAuthCursorInit(xhttpauthcursor* pCursor);
参数说明
xhttpauthcursor* pCursor游标
返回:把 challenge 游标重置到字段列表起点;输出可未对齐。

示例已编译验证

httpauthcursorinit obj;
xrtHttpAuthCursorInit(&obj, pCursor);

xrtHttpFieldChallengeNext

跨同名字段迭代 challenge;字段、游标和结果可未对齐,错误不推进游标。

xhttpnext xrtHttpFieldChallengeNext( const xhttpfield* pFields, size_t iCount, xstrview Name, xhttpauthcursor* pCursor, xhttpauth* pChallenge );
参数说明
const xhttpfield* pFields字段数组
size_t iCount数量
xstrview Name名称(xstrview)
xhttpauthcursor* pCursor游标
xhttpauth* pChallenge挑战
返回:跨同名字段迭代 challenge;字段、游标和结果可未对齐,错误不推进游标。

示例已编译验证

/* 跨同名字段迭代 challenge;字段、游标和结果可未对齐,错误不推进游标。 */
result = xrtHttpFieldChallengeNext(pFields, iCount, Name, pCursor, pChallenge);

xrtHttpAuthParse

严格解析单份凭据;结果可未对齐,失败时清空合法的结果存储。

bool xrtHttpAuthParse( xstrview Value, xhttpauth* pAuth );
参数说明
xstrview Value值
xhttpauth* pAuth认证对象
返回:严格解析单份凭据;结果可未对齐,失败时清空合法的结果存储。

示例已编译验证

/* 严格解析单份凭据;结果可未对齐,失败时清空合法的结果存储。 */
result = xrtHttpAuthParse(Value, pAuth);

xrtHttpAuthWrite

写出 scheme 与可选认证数据;长度可未对齐,结果不附加零字符。

bool xrtHttpAuthWrite( xstrview Scheme, xstrview Data, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xstrview Scheme协议方案
xstrview Data数据内容
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:写出 scheme 与可选认证数据;长度可未对齐,结果不附加零字符。

示例已编译验证

/* 写出 scheme 与可选认证数据;长度可未对齐,结果不附加零字符。 */
result = xrtHttpAuthWrite(Scheme, Data, pOutput, iCapacity, pSize);

xrtHttpAuthBuild

构建零结尾认证字段值;可选长度可未对齐,返回值由 xrtFree 释放。

str xrtHttpAuthBuild( xstrview Scheme, xstrview Data, size_t* pSize );
参数说明
xstrview Scheme协议方案
xstrview Data数据内容
size_t* pSize出:大小
返回:构建零结尾认证字段值;可选长度可未对齐,返回值由 xrtFree 释放。

示例已编译验证

/* 构建零结尾认证字段值;可选长度可未对齐,返回值由 xrtFree 释放。 */
result = xrtHttpAuthBuild(Scheme, Data, pSize);

xrtHttpBasicWrite

按原始 user:password 字节构建 Basic 字段值;长度输出可未对齐。

bool xrtHttpBasicWrite( xstrview User, xstrview Password, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xstrview User用户名
xstrview Password密码
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:按原始 user:password 字节构建 Basic 字段值;长度输出可未对齐。

示例已编译验证

/* 按原始 user:password 字节构建 Basic 字段值;长度输出可未对齐。 */
result = xrtHttpBasicWrite(User, Password, pOutput, iCapacity, pSize);

xrtHttpBasicRead

XRT_API bool xrtHttpBasicRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbasicauth* pBasic );

;
返回:XRT_API bool xrtHttpBasicRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbasicauth* pBasic );

示例已编译验证

/* XRT_API bool xrtHttpBasicRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbasicauth* pBasic ); */
result = xrtHttpBasicRead();

xrtHttpBasicChallengeRead

严格解析 Basic challenge;未知扩展参数被忽略,realm 借用 Output。

bool xrtHttpBasicChallengeRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbasicchallenge* pChallenge );
参数说明
xstrview Value值
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
xhttpbasicchallenge* pChallenge挑战
返回:严格解析 Basic challenge;未知扩展参数被忽略,realm 借用 Output。

示例已编译验证

/* 严格解析 Basic challenge;未知扩展参数被忽略,realm 借用 Output。 */
result = xrtHttpBasicChallengeRead(Value, pOutput, iCapacity, pSize, pChallenge);

xrtHttpBasicChallengeWrite

写出带 quoted realm 和可选 UTF-8 声明的 Basic challenge;长度可未对齐。

bool xrtHttpBasicChallengeWrite( xstrview Realm, bool bUtf8, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xstrview Realm认证域
bool bUtf8bUtf8 参数
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:写出带 quoted realm 和可选 UTF-8 声明的 Basic challenge;长度可未对齐。

示例已编译验证

/* 写出带 quoted realm 和可选 UTF-8 声明的 Basic challenge;长度可未对齐。 */
result = xrtHttpBasicChallengeWrite(Realm, bUtf8, pOutput, iCapacity, pSize);

xrtHttpBearerTokenValid

按 RFC 6750 b64token 规则判断 Bearer token。

bool xrtHttpBearerTokenValid(xstrview Token);
参数说明
xstrview Token令牌
返回:按 RFC 6750 b64token 规则判断 Bearer token。

示例已编译验证

/* 按 RFC 6750 b64token 规则判断 Bearer token。 */
result = xrtHttpBearerTokenValid(Token);

xrtHttpBearerWrite

校验并写出完整 Bearer 字段值;结果不补零,长度输出可未对齐。

bool xrtHttpBearerWrite( xstrview Token, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xstrview Token令牌
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:校验并写出完整 Bearer 字段值;结果不补零,长度输出可未对齐。

示例已编译验证

/* 校验并写出完整 Bearer 字段值;结果不补零,长度输出可未对齐。 */
result = xrtHttpBearerWrite(Token, pOutput, iCapacity, pSize);

xrtHttpBearerRead

严格解析完整 Bearer 字段值;结果可未对齐,Token 借用输入。

bool xrtHttpBearerRead( xstrview Value, xstrview* pToken );
参数说明
xstrview Value值
xstrview* pToken令牌
返回:严格解析完整 Bearer 字段值;结果可未对齐,Token 借用输入。

示例已编译验证

/* 严格解析完整 Bearer 字段值;结果可未对齐,Token 借用输入。 */
result = xrtHttpBearerRead(Value, pToken);

xrtHttpBearerChallengeRead

XRT_API bool xrtHttpBearerChallengeRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbearerchallenge* pChallenge );

;
返回:XRT_API bool xrtHttpBearerChallengeRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbearerchallenge* pChallenge );

示例已编译验证

/* XRT_API bool xrtHttpBearerChallengeRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbearerchallenge* pChallenge ); */
result = xrtHttpBearerChallengeRead();

xrtHttpBearerChallengeWrite

XRT_API bool xrtHttpBearerChallengeWrite( const xhttpbearerchallenge* pChallenge, void* pOutput, size_t iCapacity, size_t* pSize );

;
返回:XRT_API bool xrtHttpBearerChallengeWrite( const xhttpbearerchallenge* pChallenge, void* pOutput, size_t iCapacity, size_t* pSize );

示例已编译验证

/* XRT_API bool xrtHttpBearerChallengeWrite( const xhttpbearerchallenge* pChallenge, void* pOutput, size_t iCapacity, size_t* pSize ); */
result = xrtHttpBearerChallengeWrite();

xrtHttpDigestAlgorithmParse

解析 RFC 7616 算法 token;未知或无效名称返回 UNKNOWN 且不修改错误槽。

xhttpdigestalgorithm xrtHttpDigestAlgorithmParse(xstrview Name);
参数说明
xstrview Name名称(xstrview)
返回:解析 RFC 7616 算法 token;未知或无效名称返回 UNKNOWN 且不修改错误槽。

示例已编译验证

/* 解析 RFC 7616 算法 token;未知或无效名称返回 UNKNOWN 且不修改错误槽。 */
result = xrtHttpDigestAlgorithmParse(Name);

xrtHttpDigestAlgorithmName

返回算法的规范线路名称;UNKNOWN 返回空视图且不修改错误槽。

xstrview xrtHttpDigestAlgorithmName( xhttpdigestalgorithm Algorithm );
参数说明
xhttpdigestalgorithm Algorithm算法标识
返回:返回算法的规范线路名称;UNKNOWN 返回空视图且不修改错误槽。

示例已编译验证

/* 返回算法的规范线路名称;UNKNOWN 返回空视图且不修改错误槽。 */
result = xrtHttpDigestAlgorithmName(Algorithm);

xrtHttpDigestSize

返回二进制摘要长度;未知算法返回零。

size_t xrtHttpDigestSize(xhttpdigestalgorithm Algorithm);
参数说明
xhttpdigestalgorithm Algorithm算法标识
返回:返回二进制摘要长度;未知算法返回零。

示例已编译验证

/* 返回二进制摘要长度;未知算法返回零。 */
result = xrtHttpDigestSize(Algorithm);

xrtHttpDigestAlgorithmSession

判断算法是否是 -sess 变体。

bool xrtHttpDigestAlgorithmSession( xhttpdigestalgorithm Algorithm );
参数说明
xhttpdigestalgorithm Algorithm算法标识
返回:判断算法是否是 -sess 变体。

示例已编译验证

/* 判断算法是否是 -sess 变体。 */
result = xrtHttpDigestAlgorithmSession(Algorithm);

xrtHttpDigestAlgorithmSupported

判断当前裁剪闭包是否包含指定算法的计算后端。

bool xrtHttpDigestAlgorithmSupported( xhttpdigestalgorithm Algorithm );
参数说明
xhttpdigestalgorithm Algorithm算法标识
返回:判断当前裁剪闭包是否包含指定算法的计算后端。

示例已编译验证

/* 判断当前裁剪闭包是否包含指定算法的计算后端。 */
result = xrtHttpDigestAlgorithmSupported(Algorithm);

xrtHttpDigestQopParse

解析单个 qop token;未知或无效值返回 NONE。

xhttpdigestqop xrtHttpDigestQopParse(xstrview Name);
参数说明
xstrview Name名称(xstrview)
返回:解析单个 qop token;未知或无效值返回 NONE。

示例已编译验证

/* 解析单个 qop token;未知或无效值返回 NONE。 */
result = xrtHttpDigestQopParse(Name);

xrtHttpDigestQopName

返回 qop 的规范线路名称;NONE 返回空视图。

xstrview xrtHttpDigestQopName(xhttpdigestqop Qop);
参数说明
xhttpdigestqop QopQo 参数
返回:返回 qop 的规范线路名称;NONE 返回空视图。

示例已编译验证

/* 返回 qop 的规范线路名称;NONE 返回空视图。 */
result = xrtHttpDigestQopName(Qop);

xrtHttpDigestHash

使用所选 Digest 算法散列任意连续数据,并写出规范小写十六进制。

bool xrtHttpDigestHash( xhttpdigestalgorithm Algorithm, const void* pData, size_t iDataSize, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xhttpdigestalgorithm Algorithm算法标识
const void* pData用户数据
size_t iDataSizeDataSze 参数
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:使用所选 Digest 算法散列任意连续数据,并写出规范小写十六进制。

示例已编译验证

/* 使用所选 Digest 算法散列任意连续数据,并写出规范小写十六进制。 */
result = xrtHttpDigestHash(Algorithm, pData, iDataSize, pOutput, iCapacity, pSize);

xrtHttpDigestSecret

计算可持久化的 H(username:realm:password);session 算法仍返回基础值。

bool xrtHttpDigestSecret( xhttpdigestalgorithm Algorithm, xstrview Username, xstrview Realm, xstrview Password, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xhttpdigestalgorithm Algorithm算法标识
xstrview Username用户名
xstrview Realm认证域
xstrview Password密码
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:计算可持久化的 H(username:realm:password);session 算法仍返回基础值。

示例已编译验证

/* 计算可持久化的 H(username:realm:password);session 算法仍返回基础值。 */
result = xrtHttpDigestSecret(Algorithm, Username, Realm, Password, pOutput, iCapacity, pSize);

xrtHttpDigestUserHash

计算 RFC 7616 userhash,即 H(username:realm)。

bool xrtHttpDigestUserHash( xhttpdigestalgorithm Algorithm, xstrview Username, xstrview Realm, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xhttpdigestalgorithm Algorithm算法标识
xstrview Username用户名
xstrview Realm认证域
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:计算 RFC 7616 userhash,即 H(username:realm)。

示例已编译验证

/* 计算 RFC 7616 userhash,即 H(username:realm)。 */
result = xrtHttpDigestUserHash(Algorithm, Username, Realm, pOutput, iCapacity, pSize);

xrtHttpDigestRequest

计算 Authorization 中的 request-digest;Method 使用请求线路中的原始方法。

bool xrtHttpDigestRequest( const xhttpdigestproof* pProof, xstrview Method, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
const xhttpdigestproof* pProofProof 参数
xstrview MethodHTTP 方法
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:计算 Authorization 中的 request-digest;Method 使用请求线路中的原始方法。

示例已编译验证

/* 计算 Authorization 中的 request-digest;Method 使用请求线路中的原始方法。 */
result = xrtHttpDigestRequest(pProof, Method, pOutput, iCapacity, pSize);

xrtHttpDigestRspAuth

计算 Authentication-Info 中的 rspauth。

bool xrtHttpDigestRspAuth( const xhttpdigestproof* pProof, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
const xhttpdigestproof* pProofProof 参数
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:计算 Authentication-Info 中的 rspauth。

示例已编译验证

/* 计算 Authentication-Info 中的 rspauth。 */
result = xrtHttpDigestRspAuth(pProof, pOutput, iCapacity, pSize);

xrtHttpDigestEqual

不修改错误槽地常量时间比较两个大小写不敏感的十六进制摘要。

bool xrtHttpDigestEqual(xstrview Left, xstrview Right);
参数说明
xstrview LeftLeft 参数
xstrview RightRght 参数
返回:不修改错误槽地常量时间比较两个大小写不敏感的十六进制摘要。

示例已编译验证

/* 不修改错误槽地常量时间比较两个大小写不敏感的十六进制摘要。 */
result = xrtHttpDigestEqual(Left, Right);

xrtHttpDigestNonceWrite

XRT_API bool xrtHttpDigestNonceWrite( xbytesview Key, xbytesview Context, int64 iIssuedSeconds, const void* pSalt, void* pOutput, size_t iCapacity, size_t* pSize );

;
返回:XRT_API bool xrtHttpDigestNonceWrite( xbytesview Key, xbytesview Context, int64 iIssuedSeconds, const void* pSalt, void* pOutput, size_t iCapacity, size_t* pSize );

示例已编译验证

/* XRT_API bool xrtHttpDigestNonceWrite( xbytesview Key, xbytesview Context, int64 iIssuedSeconds, const void* pSalt, void* pOutput, size_t iCapacity, size_t* pSize ); */
result = xrtHttpDigestNonceWrite();

xrtHttpDigestNonceVerify

XRT_API xhttpdigestnoncecheck xrtHttpDigestNonceVerify( xstrview Nonce, xbytesview Key, xbytesview Context, int64 iNowSeconds, int64 iLifetimeSeconds, int64 iFutureSkewSeconds, int64* pIssuedSeconds );

;
返回:XRT_API xhttpdigestnoncecheck xrtHttpDigestNonceVerify( xstrview Nonce, xbytesview Key, xbytesview Context, int64 iNowSeconds, int64 iLifetimeSeconds, int64 iFutureSkewSeconds, int64* pIssuedSeconds );

示例已编译验证

/* XRT_API xhttpdigestnoncecheck xrtHttpDigestNonceVerify( xstrview Nonce, xbytesview Key, xbytesview Context, int64 iNowSeconds, int64 iLifetimeSeconds, int64 iFutureSkewSeconds, int64* pIssuedSeconds ); */
result = xrtHttpDigestNonceVerify();

xrtHttpDigestNonceCreate

使用操作系统安全随机源生成 salt,再构建无状态 nonce。

bool xrtHttpDigestNonceCreate( xbytesview Key, xbytesview Context, int64 iIssuedSeconds, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
xbytesview Key键
xbytesview Context上下文
int64 iIssuedSecondsIssuedSeconds 参数
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:使用操作系统安全随机源生成 salt,再构建无状态 nonce。

示例已编译验证

/* 使用操作系统安全随机源生成 salt,再构建无状态 nonce。 */
xhandle* h = xrtHttpDigestNonceCreate(Key, Context, iIssuedSeconds, pOutput, iCapacity, pSize);

xrtHttpDigestProofVerify

XRT_API xhttpdigestverifycheck xrtHttpDigestProofVerify( const xhttpdigestverification* pVerification );

;
返回:XRT_API xhttpdigestverifycheck xrtHttpDigestProofVerify( const xhttpdigestverification* pVerification );

示例已编译验证

/* XRT_API xhttpdigestverifycheck xrtHttpDigestProofVerify( const xhttpdigestverification* pVerification ); */
result = xrtHttpDigestProofVerify();

xrtHttpDigestVerify

XRT_API xhttpdigestverifycheck xrtHttpDigestVerify( const xhttpdigestverification* pVerification, xbytesview NonceKey, xbytesview NonceContext, int64 iNowSeconds, int64 iLifetimeSeconds, int64 iFutureSkewSeconds, int64* pIssuedSeconds );

;
返回:XRT_API xhttpdigestverifycheck xrtHttpDigestVerify( const xhttpdigestverification* pVerification, xbytesview NonceKey, xbytesview NonceContext, int64 iNowSeconds, int64 iLifetimeSeconds, int64 iFutureSkewSeconds, int64* pIssuedSeconds );

示例已编译验证

/* XRT_API xhttpdigestverifycheck xrtHttpDigestVerify( const xhttpdigestverification* pVerification, xbytesview NonceKey, xbytesview NonceContext, int64 iNowSeconds, int64 iLifetimeSeconds, int64 iFutureSkewSeconds, int64* pIssuedSeconds ); */
result = xrtHttpDigestVerify();

xrtHttpDigestPolicyInit

初始化现代默认策略:SHA-2、auth/auth-int、优先 auth、遵循 userhash。

void xrtHttpDigestPolicyInit( xhttpdigestpolicy* pPolicy );
参数说明
xhttpdigestpolicy* pPolicy策略
返回:初始化现代默认策略:SHA-2、auth/auth-int、优先 auth、遵循 userhash。

示例已编译验证

httpdigestpolicyinit obj;
xrtHttpDigestPolicyInit(&obj, pPolicy);

xrtHttpDigestChallengeChoose

XRT_API xhttpdigestchoosecheck xrtHttpDigestChallengeChoose( const xhttpdigestchallenge* pChallenge, const xhttpdigestpolicy* pPolicy, xhttpdigestchoice* pChoice );

;
返回:XRT_API xhttpdigestchoosecheck xrtHttpDigestChallengeChoose( const xhttpdigestchallenge* pChallenge, const xhttpdigestpolicy* pPolicy, xhttpdigestchoice* pChoice );

示例已编译验证

/* XRT_API xhttpdigestchoosecheck xrtHttpDigestChallengeChoose( const xhttpdigestchallenge* pChallenge, const xhttpdigestpolicy* pPolicy, xhttpdigestchoice* pChoice ); */
result = xrtHttpDigestChallengeChoose();

xrtHttpDigestClientAuth

XRT_API bool xrtHttpDigestClientAuth( const xhttpdigestclientauth* pInput, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestauth* pAuth );

;
返回:XRT_API bool xrtHttpDigestClientAuth( const xhttpdigestclientauth* pInput, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestauth* pAuth );

示例已编译验证

/* XRT_API bool xrtHttpDigestClientAuth( const xhttpdigestclientauth* pInput, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestauth* pAuth ); */
result = xrtHttpDigestClientAuth();

xrtHttpDigestInfoVerify

XRT_API xhttpdigestinfocheck xrtHttpDigestInfoVerify( const xhttpdigestinfoverification* pVerification );

;
返回:XRT_API xhttpdigestinfocheck xrtHttpDigestInfoVerify( const xhttpdigestinfoverification* pVerification );

示例已编译验证

/* XRT_API xhttpdigestinfocheck xrtHttpDigestInfoVerify( const xhttpdigestinfoverification* pVerification ); */
result = xrtHttpDigestInfoVerify();

xrtHttpDigestSessionCreate

创建并复制 Digest 客户端状态;首个请求的 nonce-count 为 1。

xhttpdigestsession* xrtHttpDigestSessionCreate( const xhttpdigestsessionconfig* pConfig );
参数说明
const xhttpdigestsessionconfig* pConfig配置结构
返回:创建并复制 Digest 客户端状态;首个请求的 nonce-count 为 1。

示例已编译验证

/* 创建并复制 Digest 客户端状态;首个请求的 nonce-count 为 1。 */
xhandle* h = xrtHttpDigestSessionCreate();

xrtHttpDigestSessionRetain

增加会话引用;Exchange 会自动持有创建它的会话。

xhttpdigestsession* xrtHttpDigestSessionRetain( xhttpdigestsession* pSession );
参数说明
xhttpdigestsession* pSession会话对象
返回:增加会话引用;Exchange 会自动持有创建它的会话。

示例已编译验证

/* 增加会话引用;Exchange 会自动持有创建它的会话。 */
result = xrtHttpDigestSessionRetain(pSession);

xrtHttpDigestSessionRelease

释放会话引用;空指针是安全空操作。

void xrtHttpDigestSessionRelease( xhttpdigestsession* pSession );
参数说明
xhttpdigestsession* pSession会话对象
返回:释放会话引用;空指针是安全空操作。

示例已编译验证

xrtHttpDigestSessionRelease(pSession);

xrtHttpDigestSessionUpdate

原子替换 challenge、选择结果与凭据,并把 nonce-count 重置为 1。

bool xrtHttpDigestSessionUpdate( xhttpdigestsession* pSession, const xhttpdigestsessionconfig* pConfig );
参数说明
xhttpdigestsession* pSession会话对象
const xhttpdigestsessionconfig* pConfig配置结构
返回:原子替换 challenge、选择结果与凭据,并把 nonce-count 重置为 1。

示例已编译验证

/* 原子替换 challenge、选择结果与凭据,并把 nonce-count 重置为 1。 */
result = xrtHttpDigestSessionUpdate(pSession, pConfig);

xrtHttpDigestSessionAuthorize

为一次请求保留唯一 nonce-count;返回对象可跨线程等待乱序响应。

xhttpdigestexchange* xrtHttpDigestSessionAuthorize( xhttpdigestsession* pSession, xstrview Method, xstrview RequestTarget, xstrview EntityHash );
参数说明
xhttpdigestsession* pSession会话对象
xstrview MethodHTTP 方法
xstrview RequestTargetRequestTarget 参数
xstrview EntityHash实体哈希
返回:为一次请求保留唯一 nonce-count;返回对象可跨线程等待乱序响应。

示例已编译验证

/* 为一次请求保留唯一 nonce-count;返回对象可跨线程等待乱序响应。 */
result = xrtHttpDigestSessionAuthorize(pSession, Method, RequestTarget, EntityHash);

xrtHttpDigestExchangeRetain

增加请求 Exchange 引用。

xhttpdigestexchange* xrtHttpDigestExchangeRetain( xhttpdigestexchange* pExchange );
参数说明
xhttpdigestexchange* pExchange交换对象
返回:增加请求 Exchange 引用。

示例已编译验证

/* 增加请求 Exchange 引用。 */
result = xrtHttpDigestExchangeRetain(pExchange);

xrtHttpDigestExchangeRelease

释放 Exchange 及其持有的会话、状态和敏感数据。

void xrtHttpDigestExchangeRelease( xhttpdigestexchange* pExchange );
参数说明
xhttpdigestexchange* pExchange交换对象
返回:释放 Exchange 及其持有的会话、状态和敏感数据。

示例已编译验证

xrtHttpDigestExchangeRelease(pExchange);

xrtHttpDigestExchangeAuth

返回 Exchange 生命周期内稳定的 Authorization 协议对象。

const xhttpdigestauth* xrtHttpDigestExchangeAuth( const xhttpdigestexchange* pExchange );
参数说明
const xhttpdigestexchange* pExchange交换对象
返回:返回 Exchange 生命周期内稳定的 Authorization 协议对象。

示例已编译验证

/* 返回 Exchange 生命周期内稳定的 Authorization 协议对象。 */
result = xrtHttpDigestExchangeAuth(pExchange);

xrtHttpDigestExchangeProof

返回 Exchange 生命周期内稳定的响应验证 proof。

const xhttpdigestproof* xrtHttpDigestExchangeProof( const xhttpdigestexchange* pExchange );
参数说明
const xhttpdigestexchange* pExchange交换对象
返回:返回 Exchange 生命周期内稳定的响应验证 proof。

示例已编译验证

/* 返回 Exchange 生命周期内稳定的响应验证 proof。 */
result = xrtHttpDigestExchangeProof(pExchange);

xrtHttpDigestSessionAccept

XRT_API xhttpdigestsessioncheck xrtHttpDigestSessionAccept( xhttpdigestsession* pSession, const xhttpdigestexchange* pExchange, const xhttpdigestinfo* pInfo, xstrview ResponseEntityHash, xstrview NextCnonce );

;
返回:XRT_API xhttpdigestsessioncheck xrtHttpDigestSessionAccept( xhttpdigestsession* pSession, const xhttpdigestexchange* pExchange, const xhttpdigestinfo* pInfo, xstrview ResponseEntityHash, xstrview NextCnonce );

示例已编译验证

/* XRT_API xhttpdigestsessioncheck xrtHttpDigestSessionAccept( xhttpdigestsession* pSession, const xhttpdigestexchange* pExchange, const xhttpdigestinfo* pInfo, xstrview ResponseEntityHash, xstrview NextCnonce ); */
result = xrtHttpDigestSessionAccept();

xrtHttpDigestReplayConfigInit

初始化适合普通多线程 HTTP 服务的有界默认配置。

void xrtHttpDigestReplayConfigInit( xhttpdigestreplayconfig* pConfig );
参数说明
xhttpdigestreplayconfig* pConfig配置结构
返回:初始化适合普通多线程 HTTP 服务的有界默认配置。

示例已编译验证

httpdigestreplayconfiginit obj;
xrtHttpDigestReplayConfigInit(&obj);

xrtHttpDigestReplayKey

从用户名、nonce 和 cnonce 构建无歧义的固定重放键。

bool xrtHttpDigestReplayKey( xstrview Username, xstrview Nonce, xstrview Cnonce, xhttpdigestreplaykey* pKey );
参数说明
xstrview Username用户名
xstrview Noncenonce
xstrview Cnonce客户端 nonce
xhttpdigestreplaykey* pKey键
返回:从用户名、nonce 和 cnonce 构建无歧义的固定重放键。

示例已编译验证

/* 从用户名、nonce 和 cnonce 构建无歧义的固定重放键。 */
result = xrtHttpDigestReplayKey(Username, Nonce, Cnonce, pKey);

xrtHttpDigestReplayCreate

创建并发安全的内置重放表;配置为空时使用默认值。

xhttpdigestreplay* xrtHttpDigestReplayCreate( const xhttpdigestreplayconfig* pConfig );
参数说明
const xhttpdigestreplayconfig* pConfig配置结构
返回:创建并发安全的内置重放表;配置为空时使用默认值。

示例已编译验证

/* 创建并发安全的内置重放表;配置为空时使用默认值。 */
xhandle* h = xrtHttpDigestReplayCreate();

xrtHttpDigestReplayDestroy

销毁重放表;空指针是安全空操作,不能与其他操作并发。

void xrtHttpDigestReplayDestroy( xhttpdigestreplay* pReplay );
参数说明
xhttpdigestreplay* pReplayRelay 参数
返回:销毁重放表;空指针是安全空操作,不能与其他操作并发。

示例已编译验证

xrtHttpDigestReplayDestroy(pReplay);

xrtHttpDigestReplayCheckKey

按预先派生的键原子检查并推进最大 nonce-count。

xhttpdigestreplaycheck xrtHttpDigestReplayCheckKey( xhttpdigestreplay* pReplay, const xhttpdigestreplaykey* pKey, uint32 iNonceCount, int64 iIssuedSeconds, int64 iNowSeconds );
参数说明
xhttpdigestreplay* pReplayRelay 参数
const xhttpdigestreplaykey* pKey键
uint32 iNonceCountNonceCount 参数
int64 iIssuedSecondsIssuedSeconds 参数
int64 iNowSecondsNowSeconds 参数
返回:按预先派生的键原子检查并推进最大 nonce-count。

示例已编译验证

/* 按预先派生的键原子检查并推进最大 nonce-count。 */
result = xrtHttpDigestReplayCheckKey(pReplay, pKey, iNonceCount, iIssuedSeconds, iNowSeconds);

xrtHttpDigestReplayCheck

派生键并原子检查,适合已经验证 Digest 证明的普通服务端路径。

xhttpdigestreplaycheck xrtHttpDigestReplayCheck( xhttpdigestreplay* pReplay, xstrview Username, xstrview Nonce, xstrview Cnonce, uint32 iNonceCount, int64 iIssuedSeconds, int64 iNowSeconds );
参数说明
xhttpdigestreplay* pReplayRelay 参数
xstrview Username用户名
xstrview Noncenonce
xstrview Cnonce客户端 nonce
uint32 iNonceCountNonceCount 参数
int64 iIssuedSecondsIssuedSeconds 参数
int64 iNowSecondsNowSeconds 参数
返回:派生键并原子检查,适合已经验证 Digest 证明的普通服务端路径。

示例已编译验证

/* 派生键并原子检查,适合已经验证 Digest 证明的普通服务端路径。 */
result = xrtHttpDigestReplayCheck(pReplay, Username, Nonce, Cnonce, iNonceCount, iIssuedSeconds, iNowSeconds);

xrtHttpDigestReplayPurge

删除指定时间已经超出 nonce 有效期的记录并返回删除数量。

size_t xrtHttpDigestReplayPurge( xhttpdigestreplay* pReplay, int64 iNowSeconds );
参数说明
xhttpdigestreplay* pReplayRelay 参数
int64 iNowSecondsNowSeconds 参数
返回:删除指定时间已经超出 nonce 有效期的记录并返回删除数量。

示例已编译验证

/* 删除指定时间已经超出 nonce 有效期的记录并返回删除数量。 */
result = xrtHttpDigestReplayPurge(pReplay, iNowSeconds);

xrtHttpDigestReplayClear

清空全部重放记录并保留映射、堆和统计计数。

void xrtHttpDigestReplayClear( xhttpdigestreplay* pReplay );
参数说明
xhttpdigestreplay* pReplayRelay 参数
返回:清空全部重放记录并保留映射、堆和统计计数。

示例已编译验证

/* 清空全部重放记录并保留映射、堆和统计计数。 */
result = xrtHttpDigestReplayClear(pReplay);

xrtHttpDigestReplayStats

取得当前容量、条目和累计策略结果;输出可位于合法未对齐存储。

bool xrtHttpDigestReplayStats( xhttpdigestreplay* pReplay, xhttpdigestreplaystats* pStats );
参数说明
xhttpdigestreplay* pReplayRelay 参数
xhttpdigestreplaystats* pStats出:统计快照
返回:取得当前容量、条目和累计策略结果;输出可位于合法未对齐存储。

示例已编译验证

/* 取得当前容量、条目和累计策略结果;输出可位于合法未对齐存储。 */
result = xrtHttpDigestReplayStats(pReplay, pStats);

xrtHttpDigestChallengeRead

XRT_API bool xrtHttpDigestChallengeRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestchallenge* pChallenge );

;
返回:XRT_API bool xrtHttpDigestChallengeRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestchallenge* pChallenge );

示例已编译验证

/* XRT_API bool xrtHttpDigestChallengeRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestchallenge* pChallenge ); */
result = xrtHttpDigestChallengeRead();

xrtHttpDigestChallengeWrite

XRT_API bool xrtHttpDigestChallengeWrite( const xhttpdigestchallenge* pChallenge, void* pOutput, size_t iCapacity, size_t* pSize );

;
返回:XRT_API bool xrtHttpDigestChallengeWrite( const xhttpdigestchallenge* pChallenge, void* pOutput, size_t iCapacity, size_t* pSize );

示例已编译验证

/* XRT_API bool xrtHttpDigestChallengeWrite( const xhttpdigestchallenge* pChallenge, void* pOutput, size_t iCapacity, size_t* pSize ); */
result = xrtHttpDigestChallengeWrite();

xrtHttpDigestAuthRead

XRT_API bool xrtHttpDigestAuthRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestauth* pDigest );

;
返回:XRT_API bool xrtHttpDigestAuthRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestauth* pDigest );

示例已编译验证

/* XRT_API bool xrtHttpDigestAuthRead( xstrview Value, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestauth* pDigest ); */
result = xrtHttpDigestAuthRead();

xrtHttpDigestAuthWrite

按 RFC 7616 的 quoted/token 线路形式规范写出完整 Digest 凭据。

bool xrtHttpDigestAuthWrite( const xhttpdigestauth* pDigest, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
const xhttpdigestauth* pDigest摘要
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:按 RFC 7616 的 quoted/token 线路形式规范写出完整 Digest 凭据。

示例已编译验证

/* 按 RFC 7616 的 quoted/token 线路形式规范写出完整 Digest 凭据。 */
result = xrtHttpDigestAuthWrite(pDigest, pOutput, iCapacity, pSize);

xrtHttpDigestInfoRead

严格解析 Digest Authentication-Info 参数列表;Algorithm 由请求上下文提供。

bool xrtHttpDigestInfoRead( xstrview Value, xhttpdigestalgorithm Algorithm, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestinfo* pInfo );
参数说明
xstrview Value值
xhttpdigestalgorithm Algorithm算法标识
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
xhttpdigestinfo* pInfo上下文信息
返回:严格解析 Digest Authentication-Info 参数列表;Algorithm 由请求上下文提供。

示例已编译验证

/* 严格解析 Digest Authentication-Info 参数列表;Algorithm 由请求上下文提供。 */
result = xrtHttpDigestInfoRead(Value, Algorithm, pOutput, iCapacity, pSize, pInfo);

xrtHttpDigestInfoWrite

写出 Digest Authentication-Info 参数列表,不添加字段名或冒号。

bool xrtHttpDigestInfoWrite( const xhttpdigestinfo* pInfo, void* pOutput, size_t iCapacity, size_t* pSize );
参数说明
const xhttpdigestinfo* pInfo上下文信息
void* pOutput出:输出缓冲
size_t iCapacity容量
size_t* pSize出:大小
返回:写出 Digest Authentication-Info 参数列表,不添加字段名或冒号。

示例已编译验证

/* 写出 Digest Authentication-Info 参数列表,不添加字段名或冒号。 */
result = xrtHttpDigestInfoWrite(pInfo, pOutput, iCapacity, pSize);