Bitzsoft.Integrations.ElectronicSignature.Asign
1.0.0-alpha.10
This is a prerelease version of Bitzsoft.Integrations.ElectronicSignature.Asign.
dotnet add package Bitzsoft.Integrations.ElectronicSignature.Asign --version 1.0.0-alpha.10
NuGet\Install-Package Bitzsoft.Integrations.ElectronicSignature.Asign -Version 1.0.0-alpha.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.ElectronicSignature.Asign" Version="1.0.0-alpha.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.ElectronicSignature.Asign" Version="1.0.0-alpha.10" />
<PackageReference Include="Bitzsoft.Integrations.ElectronicSignature.Asign" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.ElectronicSignature.Asign --version 1.0.0-alpha.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.ElectronicSignature.Asign, 1.0.0-alpha.10"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.ElectronicSignature.Asign@1.0.0-alpha.10
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.ElectronicSignature.Asign&version=1.0.0-alpha.10&prerelease
#tool nuget:?package=Bitzsoft.Integrations.ElectronicSignature.Asign&version=1.0.0-alpha.10&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.ElectronicSignature.Asign
爱签电子签章服务实现,基于爱签开放平台 API。
功能特性
- 完整实现
IElectronicSignatureProvider:覆盖合同发起、详情、下载、查看、撤销、签署 URL、签署状态、印章、模板、回调验签全部统一方法 - RSA2 (SHA256WithRSA) 签名鉴权:非空参数按 key 字典序排序拼接后用开发者 RSA 私钥签名,Base64 输出 sign 值
- 回调验签:JSON body 格式,校验 appId 匹配、时间戳新鲜度、平台公钥 RSA 验签
- partial class 扩展:通过部分类暴露爱签全部 API(签署、模板、用户、实名认证、证据链)
安装
dotnet add package Bitzsoft.Integrations.ElectronicSignature.Asign
<PackageReference Include="Bitzsoft.Integrations.ElectronicSignature.Asign" Version="1.0.0" />
配置
{
"Asign": {
"AppId": "your-app-id",
"PrivateKey": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----",
"PublicKey": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----",
"BaseUrl": "https://oapi.asign.cn",
"Timeout": "00:00:30"
}
}
| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
AppId |
是 | — | 应用标识 |
PrivateKey |
是 | — | 开发者 RSA 私钥(PKCS#8 PEM,请求签名) |
PublicKey |
是 | — | 平台 RSA 公钥(PKCS#8 PEM,回调验签) |
BaseUrl |
否 | https://oapi.asign.cn |
API 基地址(测试 https://prev.asign.cn) |
Timeout |
否 | 00:00:30 |
HTTP 请求超时(文件上传可调大) |
HttpClientName |
否 | AsignElectronicSignatureProvider |
命名 HttpClient 标识 |
注册服务
using Bitzsoft.Integrations.ElectronicSignature.Asign;
// 方式一:IConfiguration(默认读取 "Asign" 配置节)
services.AddBitzsoftAsignElectronicSignature(configuration);
或:
using Bitzsoft.Integrations.ElectronicSignature.Asign;
// 方式二:委托配置
services.AddBitzsoftAsignElectronicSignature(options =>
{
options.AppId = "your-app-id";
options.PrivateKey = File.ReadAllText("private_key.pem");
options.PublicKey = File.ReadAllText("public_key.pem");
options.BaseUrl = "https://oapi.asign.cn";
});
请求审计
内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认 NullRequestLogStore 不持久化。
// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddBitzsoftAsignElectronicSignature(configuration);
// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
opts.MaxInMemoryBodyBytes = 64 * 1024; // 仅控制内存/加密临时文件切换,不截断正文
opts.SensitiveFields.Add("PrivateKey");
});
services.AddBitzsoftAsignElectronicSignature(configuration);
使用示例
统一抽象
// 注入 IElectronicSignatureProvider,ProviderName == "Asign"
// 爱签流程:发起签署(精简版),返回合同编号
var createResult = await provider.CreateContractAsync(new SimpleContractRequest
{
Title = "采购合同",
FileName = "contract.pdf",
FileData = await File.ReadAllBytesAsync("contract.pdf"),
SignerName = "张三",
SignerPhone = "13800000000"
});
var contractNo = createResult.Data!;
// 查询签署状态、获取签署页面、下载合同
var status = await provider.GetSigningStatusAsync(contractNo);
var signUrl = await provider.GetSigningUrlAsync(contractNo, "account");
var bytes = await provider.DownloadContractAsync(contractNo);
扩展 API(partial class)
统一接口仅覆盖极简场景,完整签署、模板、用户、认证、证据链等通过 AsignElectronicSignatureProvider 的 partial class 方法调用:
var asign = (AsignElectronicSignatureProvider)provider;
// 发起完整版签署(复杂场景)
var result = await asign.QueryPostAsync(AsignApis.StartSign, body: new { /* ... */ });
扩展方法按领域拆分:Signing(12)、Templates(7)、Users(11)、Verification(8)、Evidence(3)。
核心类型一览
| 类型 | 说明 |
|---|---|
AsignOptions |
连接配置(AppId / PrivateKey / PublicKey / BaseUrl / Timeout / HttpClientName) |
AsignElectronicSignatureProvider |
IElectronicSignatureProvider 实现,partial class 暴露扩展 API |
AsignCallbackParser |
IElectronicSignatureCallbackParser 实现 |
AsignApis |
API 端点常量 |
AsignQueryResult |
供应商响应解析 |
依赖
- Bitzsoft.Integrations.Compatibility:基础工具库
- Bitzsoft.Integrations.ElectronicSignature:统一抽象
- Bitzsoft.Integrations.RequestLogging:请求审计
相关包
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.10)
- Bitzsoft.Integrations.ElectronicSignature (>= 1.0.0-alpha.10)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0-alpha.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.10)
- Bitzsoft.Integrations.ElectronicSignature (>= 1.0.0-alpha.10)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0-alpha.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.10)
- Bitzsoft.Integrations.ElectronicSignature (>= 1.0.0-alpha.10)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0-alpha.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Bitzsoft.Integrations.ElectronicSignature.Asign:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.All
Bitzsoft 第三方集成聚合包 — net5.0 包含传统连接器,net8.0+ 额外包含受上游 TFM 限制的 AI 模块 |
|
|
Bitzsoft.Integrations.ElectronicSignature.All
电子签章聚合包 — 包含君子签 / 法大大 / 爱签 / 上上签 / e签宝 / 契约锁 / 安证通 / 腾讯电子签全部实现 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-alpha.10 | 0 | 7/26/2026 |
| 1.0.0-alpha.9 | 56 | 7/12/2026 |
| 1.0.0-alpha.8 | 63 | 7/1/2026 |
| 1.0.0-alpha.7 | 79 | 6/16/2026 |
| 1.0.0-alpha.6 | 68 | 6/16/2026 |
| 1.0.0-alpha.5 | 78 | 6/14/2026 |
| 1.0.0-alpha.3 | 70 | 6/7/2026 |