Unterstützung für XAdES Signatur mit Node.js über C++

Einführung

Aspose.Cells unterstützt das Signieren von Arbeitsmappen mit XAdES Signatur. Für diese API steht die DigitalSignature-Klasse und das XAdESType-Aufzählung.

Wie man eine XAdES-Signatur für Excel hinzufügt

Das folgende Codebeispiel zeigt die Verwendung der DigitalSignature-Klasse zum Signieren der Quelle-Arbeitsmappe.

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// Source directory
const sourceDir = path.join(__dirname, "data");
// Output directory
const outputDir = path.join(__dirname, "output");

const filePath = path.join(sourceDir, "sourceFile.xlsx");
const workbook = new AsposeCells.Workbook(filePath);
const password = "pfxPassword";

const pfx = path.join(sourceDir, "AsposeDemo.pfx");


const signature = new AsposeCells.DigitalSignature(pfx, "aspose", "testXAdES", new Date());
signature.setXAdESType(AsposeCells.XAdESType.XAdES);
const dsCollection = new AsposeCells.DigitalSignatureCollection();
dsCollection.add(signature);

workbook.setDigitalSignature(dsCollection);

workbook.save(outputDir + "XAdESSignatureSupport_out.xlsx");