Skip to content
Bitzsoft.Integrationsbitzsoft.integrations

Reference

腾讯电子签 ElectronicSignature

腾讯电子签服务——TC3-HMAC-SHA256 签名(腾讯云签名 v3)。

Last updated

基于腾讯电子签 API 实现,采用腾讯云签名 v3(TC3-HMAC-SHA256)鉴权机制。

包信息

  • NuGet 包:Bitzsoft.Integrations.ElectronicSignature.Tencent
  • 接口:IElectronicSignatureProvider
  • 鉴权:TC3-HMAC-SHA256(SecretId / SecretKey)
  • Provider ID:Tencent

配置

字段类型必填默认值说明
SecretIdstring腾讯云访问密钥 ID
SecretKeystring腾讯云访问密钥 Key
VersionstringAPI 常量值API 版本
Endpointstring默认接入点业务接口接入点
BaseUrlstringhttps://{Endpoint}派生自 Endpoint
FileEndpointstring默认文件接入点UploadFiles 接口使用的文件服务域名
Regionstring?腾讯云地域(可选)
OperatorUserIdstring自建应用经办人 UserId
ProxyOrganizationIdstring?代理企业 ID(集团子公司代发场景)
DefaultFlowTypestring?默认合同类型
DefaultSignUrlJumpUrlstring?默认 H5 签署完成后跳转地址
UseSandboxboolfalse是否使用测试环境
TimeoutTimeSpan00:01:40HTTP 请求超时
HttpClientNamestringTencentElectronicSignatureHttpClient 注册名称
{
"ElectronicSignature": {
"Tencent": {
"SecretId": "your-secret-id",
"SecretKey": "your-secret-key",
"OperatorUserId": "your-operator-user-id",
"UseSandbox": false
}
}
}

注册

using Bitzsoft.Integrations.ElectronicSignature.Tencent;
// 方式一:IConfiguration(默认读取 "ElectronicSignature:Tencent" 配置节)
services.AddBitzsoftTencentElectronicSignature(configuration);
// 方式二:委托配置
services.AddBitzsoftTencentElectronicSignature(options =>
{
options.SecretId = "your-secret-id";
options.SecretKey = "your-secret-key";
options.OperatorUserId = "your-operator-user-id";
});

使用示例

var createResult = await provider.CreateContractAsync(new SimpleContractRequest
{
Title = "服务协议",
FileName = "contract.pdf",
FileData = await File.ReadAllBytesAsync("contract.pdf"),
SignerName = "吴十",
SignerPhone = "13200000000"
});
var contractId = createResult.Data!;
var detail = await provider.GetContractDetailAsync(contractId);
var status = await provider.GetSigningStatusAsync(contractId);

鉴权机制

  • 采用腾讯云签名 v3 规范:按规范拼接规范请求串,再派生签名串,逐层 HMAC-SHA256 计算签名。
  • TencentElectronicSignatureHttpClient 以 Typed Client 模式注册。

已知限制

OperatorUserId 为必填项(自建应用经办人)。统一接口覆盖极简场景,复杂业务通过 partial class 扩展。

100%

滚轮或按钮缩放 · 放大后拖动画面 · 双击切换 100% / 200%