DigitalSignature 接口描述

 

用于添加数字签名到Doc或Docx文档。

接口方法1:addDigitalSignatureInRequest()添加数字签名

HTTP 请求方法:PUT

请求URL:https://api.e-iceblue.cn/v1/word/document/digitalSignatureInRequest

请求参数:

参数 是否必选 类型 可选值范围 说明
file file 原文档
password string 原文档密码,没有则为null
pfxFile file Pfx证书文件
pfxFilePassword string Pfx文件密码

代码示例:

  • .NET
  • Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
using System.IO;

namespace AddDigitalSignatureInRequest
{
    class Program
    {
        static string appId = "your id";
        static string appKey = "your key";
        static string baseUrl = "https://api.e-iceblue.cn";
        static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl);
        static DigitalSignatureApi digitalsignatureApi = new DigitalSignatureApi(wordConfiguration);
        static void Main(string[] args)
        {
            Stream docFile = new FileStream("D:/inputFile/addDigitalSignature.docx", FileMode.Open);
            Stream pfxFile = new FileStream("D:/inputFile/gary.pfx", FileMode.Open);
            string pfxFilePassword = "e-iceblue";
            string docPassword = null;
            var response = digitalsignatureApi.AddDigitalSignatureInRequest(docFile, pfxFile, pfxFilePassword, docPassword);
        }
    }
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.DigitalSignatureApi;

import java.io.File;

public class AddDigitalSignatureInRequest {

    static String appId = "your id";
    static String appKey = "your key";
    static String baseUrl = "https://api.e-iceblue.cn";
    static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl);
    static DigitalSignatureApi digitalsignatureApi = new DigitalSignatureApi(wordConfiguration);

    public static void main(String[] args) throws ApiException {

        File docFile = new File("D:/inputFile/addDigitalSignature.docx");
        File pfxFile = new File("D:/inputFile/gary.pfx");
        String pfxFilePassword = "e-iceblue";
        String docPassword = null;
        File response = digitalsignatureApi.addDigitalSignatureInRequest(docFile, pfxFile, pfxFilePassword, docPassword);
    }
}

接口方法2:addDigitalSignature()添加数字签名

HTTP请求方法:PUT

请求URL:https://api.e-iceblue.cn/v1/word/document/{name}/digitalSignature

请求参数:

参数 是否必选 类型 可选值范围 说明
name string 原文档名称
password string 原文档密码,没有则为null
folder string 存放原文档的文件夹,没有则为null
storage string 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null
pfxFile file Pfx证书文件
pfxFilePassword string Pfx文件密码
destFilePath string 结果文档的存贮路径,如果省略该参数,则默认存到根目录

代码示例:

  • .NET
  • Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;

namespace AddDigitalSignature
{
    class Program
    {
        static string appId = "your id";
        static string appKey = "your key";
        static string baseUrl = "https://api.e-iceblue.cn";
        static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl);
        static DigitalSignatureApi digitalsignatureApi = new DigitalSignatureApi(wordConfiguration);
        static void Main(string[] args)
        {
            string name = "addDigitalSignature.docx";
            Stream pfxFile = new FileStream("D:/inputFile/gary.pfx", FileMode.Open);
            string pfxFilePassword = "e-iceblue";
            string folder = "input";
            string destFilePath = "output/addDigitalSignature_output.docx";
            string storage = null;
            string docPassword = null;
            digitalsignatureApi.AddDigitalSignature(name, pfxFile, pfxFilePassword, destFilePath, folder, storage, docPassword);
        }
    }
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.DigitalSignatureApi;

import java.io.File;

public class AddDigitalSignature {

    static String appId = "your id";
    static String appKey = "your key";
    static String baseUrl = "https://api.e-iceblue.cn";
    static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl);
    static DigitalSignatureApi digitalsignatureApi = new DigitalSignatureApi(wordConfiguration);

    public static void main(String[] args) throws ApiException {

        String name = "addDigitalSignature.docx";
        File pfxFile = new File("D:/inputFile/gary.pfx");
        String pfxFilePassword = "e-iceblue";
        String folder = "input";
        String destFilePath = "output/addDigitalSignature_output.docx";
        String storage = null;
        String docPassword = null;
        digitalsignatureApi.addDigitalSignature(name, pfxFile, pfxFilePassword, destFilePath, folder, storage, docPassword);
    }
}