Поддержка подписи XAdES
Contents
[
Hide
]
Введение
Aspose.Cells поддерживает подписание книг с помощью подписи XAdES. Для этого API предоставляет класс DigitalSignature и перечисление XAdESType.
Как добавить подпись XAdES для Excel
Приведенный ниже фрагмент кода демонстрирует использование класса DigitalSignature для подписи исходной книги.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |