Stöd för XAdES signatur

Introduktion

Aspose.Cells tillhandahåller stöd för att signera arbetsböcker med XAdES-signatur. För detta tillhandahåller API:n klassen DigitalSignature och uppräkningen XAdESType.

Hur man lägger till XAdES-signatur för Excel

Följande kodsnutt visar användningen av klassen DigitalSignature för att signera källan arbetsbok.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Source directory
string sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
Workbook workbook = new Workbook(sourceDir + "sourceFile.xlsx");
string password = "pfxPassword";
string pfx = "pfxFile";
DigitalSignature signature = new DigitalSignature(File.ReadAllBytes(pfx), password, "testXAdES", DateTime.Now);
signature.XAdESType = XAdESType.XAdES;
DigitalSignatureCollection dsCollection = new DigitalSignatureCollection();
dsCollection.Add(signature);
workbook.SetDigitalSignature(dsCollection);
workbook.Save(outputDir + "XAdESSignatureSupport_out.xlsx");