THPDFCMSVerifyOptions 记录
配置 CMS 签名验证限制、外部提供者、签名策略钉住和时间戳复验
声明
THPDFCMSVerifyOptions= record
SignatureProvider: THPDFSignatureProvider;
AllowMLDSA: boolean;
OpenSSLLibraryPath: string;
MaxSignerCount: Integer;
MaxCounterSignatureDepth: Integer;
// Policy pinning is applied to primary SignerInfo values. Empty
// expected fields do not constrain the corresponding policy field
RequireSignaturePolicy: boolean;
ExpectedSignaturePolicyOID: AnsiString;
ExpectedSignaturePolicyHash: TBytes;
SignaturePolicyDocument: TBytes;
// Set this flag to hash an intentionally empty policy document
VerifySignaturePolicyDocumentHash: boolean;
RejectUnknownSignaturePolicyHash: boolean;
// Batch validation sets this when a shared timestamp cache already
// holds the verdict for the embedded signature timestamp token: token
// re-verification is skipped and the caller restores the cached
// THPDFTimestampInfo afterwards. Document timestamps (ETSI.RFC3161)
// never take this path because the token is the primary signature
SkipSignatureTimestampVerification: boolean;
class function Default: THPDFCMSVerifyOptions; static;
end;
单元
HPDFSignVerify
字段
| 字段 | 用途 |
|---|---|
SignatureProvider | 可选的外部 THPDFSignatureProvider,用于签名与验证原语;nil 表示选用内置实现 |
AllowMLDSA | 允许验证过程中的 ML-DSA 签名 |
OpenSSLLibraryPath | 验证经由 OpenSSL 后端时存放 OpenSSL 库的目录 |
MaxSignerCount | 处理的主签名者数量上限;Default 设为 256 |
MaxCounterSignatureDepth | 会签嵌套层数上限;Default 设为 8 |
RequireSignaturePolicy | 为 True 时,没有签名策略的签名判为失败 |
ExpectedSignaturePolicyOID | 主 SignerInfo 必须出示的策略 OID;为空表示不约束 |
ExpectedSignaturePolicyHash | 要钉住的预期策略摘要;为空表示不约束 |
SignaturePolicyDocument | 用于哈希比较的策略文档字节 |
VerifySignaturePolicyDocumentHash | 为 True 时对刻意留空的策略文档也计算哈希 |
RejectUnknownSignaturePolicyHash | 嵌入的策略哈希与任何预期值都不匹配时验证失败 |
SkipSignatureTimestampVerification | 批量验证期间信任缓存中该嵌入签名时间戳令牌的判定 |
Default | 类函数,返回清零记录并将 MaxSignerCount 设为 256、MaxCounterSignatureDepth 设为 8 |
使用说明
- 务必从
THPDFCMSVerifyOptions.Default出发,而不要用清零的局部变量,这样签名者与嵌套深度上限才会真正生效 - 策略钉住字段只作用于主 SignerInfo;预期字段为空时相应的策略检查不受约束
- 共享时间戳缓存已持有令牌判定时,批量验证会设置
SkipSignatureTimestampVerification;文档时间戳从不走这条路径