Skip to content
Bitzsoft.Integrationsbitzsoft.integrations

Reference

e签宝 电子签章

e签宝电子签章服务——Content-MD5 + HMAC-SHA256 请求签名。

Last updated

基于 e签宝开放平台 API 实现,采用 Content-MD5 + HMAC-SHA256 请求签名机制。

包信息

  • NuGet 包:Bitzsoft.Integrations.ElectronicSignature.ESign
  • 接口:IElectronicSignatureProvider
  • 鉴权:Content-MD5 + HMAC-SHA256(AppId / AppSecret)
  • Provider ID:ESign

配置

字段类型必填默认值说明
AppIdstring应用 AppId
AppSecretstring应用 AppSecret(参与 HMAC-SHA256 签名,不传输)
BaseUrlstringhttps://openapi.esign.cnAPI 基地址(沙箱 https://smlopenapi.esign.cn
TimeoutTimeSpan00:00:30HTTP 请求超时
HttpClientNamestringESignElectronicSignatureProviderTyped Client 注册名称(仅供接口兼容)
{
"ESign": {
"AppId": "your-app-id",
"AppSecret": "your-app-secret",
"BaseUrl": "https://openapi.esign.cn",
"Timeout": "00:00:30"
}
}

注册

using Bitzsoft.Integrations.ElectronicSignature.ESign;
// 方式一:IConfiguration(默认读取 "ESign" 配置节)
services.AddBitzsoftESignElectronicSignature(configuration);
// 方式二:委托配置
services.AddBitzsoftESignElectronicSignature(options =>
{
options.AppId = "your-app-id";
options.AppSecret = "your-app-secret";
options.BaseUrl = "https://openapi.esign.cn";
});

使用示例

var createResult = await provider.CreateContractAsync(new SimpleContractRequest
{
Title = "劳动合同",
FileName = "contract.pdf",
FileData = await File.ReadAllBytesAsync("contract.pdf"),
SignerName = "李四",
SignerPhone = "13900000000"
});
var contractId = createResult.Data!;
var status = await provider.GetSigningStatusAsync(contractId);
var seals = await provider.ListSealsAsync();

鉴权机制

  • 请求签名:对请求体计算 MD5,再与 AppSecret、时间戳等参数拼接后做 HMAC-SHA256。
  • ESignHttpClient 以 Typed Client 模式注册,HttpClientName 属性仅供接口兼容,不参与实际注册。

已知限制

统一接口覆盖极简签署场景。多签署方、审批流程等高级功能通过 partial class 扩展方法调用。

100%

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