简体   繁体   中英

Sign MS PowerPoint macros in ASP.NET Core

Since we have macros in our corporate presentation template for things like displaying slide numbers, there is a security risk by running macros from non-trusted sources. MS office allows to sign macro projects . The idea is to sign those internal macro files and forbid executing non-signed macros. For a medium-sized company, this process can't be handled manually.

For build an ASP.NET Core web application that allows users to sign their macros, I found aspose as only solution that can sign PowerPoint as well as MS Excel. It also has a sub-project called Aspose.Slides that can work on PowerPoint files. I made a working POC on Excel as well as Word, but not for PowerPoint. The documentation just shows how to create/edit/delete existing macros:

string macroTestFilePath = @"Path\To\Testfile.pptm";
var presentation = new Presentation(macroTestFilePath);
var firstVbModule = presentation.VbaProject.Modules.FirstOrDefault();

This example let me access my test macro code, but I can't find attributes like VbaProject on the presentation object or something similar to sign it, like possible on Aspose.Cells :

Workbook wb = new Workbook(dataDir + "Book1.xlsm");
X509Certificate2 cert = new X509Certificate2("SampleCert.pfx", "1234");
DigitalSignature ds = new DigitalSignature(cert, "Signing Digital Signature using Aspose.Cells", DateTime.Now);
wb.VbaProject.Sign(ds);
wb.Save("DigitallySigned_out.xlsm");

How could MS PowerPoint files be signed using ASP.NET Core? Is this possible with Aspose.Slides or are there any other libraries?

ASP.NET Core with Linux support would be prefered since we want to run the application on Docker/Kubernetes. Windows solutions only if there is no other way.

Aspose.Slides doesnt support singing VBAProject yet, but I have added this task under ID SLIDESNET-41589 , and it will be ready in the nearest releases.

Please, check the updates at Release Notes page.

Note : I am working as Developer Evangelist at Aspose.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM