
A digital signature is an electronic signature used to validate the authenticity and integrity of digital documents. When you sign a document digitally, the signature will serve as a confirmation that the document came from you and it has not been changed since you signed it.
In this article, you will learn how to add a digital signature to a PowerPoint in C#.
- Use a PowerPoint Library to Sign PowerPoint Digitally
- Get a Signing Certificate
- Add Digital Signature to PowerPoint in C#
- Verify a Digitally Signed PPT in C#
Use a PowerPoint Library to Sign PowerPoint Digitally
The Microsoft PowerPoint app provides functions that allow users to add digital signatures to their PPT and PPTX presentations.

However, to add a digital signature to a PowerPoint PPT or PPTX in C#, you have to use Aspose.Slides for .NET. The latter is a PowerPoint library that allows you to create, modify, and manipulate presentations using simple lines of code. For information on installing Aspose.Slides for .NET, see this Installation guide.
Get a Signing Certificate
Furthermore, to append a digital signature to a PowerPoint document, you need a signing or digital certificate. Such a certificate identifies and proves your identity. You can create your own certificate, or you can get one from a certification authority (that issues certificates).
When you send a PowerPoint presentation that you digitally signed to someone, you are effectively sending that person your certificate and public key.
Add Digital Signature to PowerPoint in C#
Assuming you have a digital certificate ready for use, you can go through these steps to add a digital signature to your PowerPoint presentation:
- Load the PowerPoint to which you want to add a digital signature through the Presentation class.
- Using the DigitalSignature class, create a digital signature object. Pass the digital signature PFX file and password to it.
- Add the digital signature to the PowerPoint presentation.
- Save the modified presentation.
This C# code shows you how to add a digital signature to a PowerPoint:
using (Presentation pres = new Presentation())
{
// Creates a DigitalSignature object with the PFX file and PFX password
DigitalSignature signature = new DigitalSignature("testsignature1.pfx", @"testpass1");
// Comments new digital signature
signature.Comments = "Aspose.Slides digital signing test.";
// Adds digital signature to the presentation
pres.DigitalSignatures.Add(signature);
// Saves the modified presentation
pres.Save("SomeSignedPresentation.pptx", SaveFormat.Pptx);
}
Verify a Digitally Signed PPT in C#
Besides adding a digital signature to a PowerPoint PPT, Aspose.Slides for .NET also allows you to verify a digitally signed presentation. The verification operation essentially checks whether the presentation has been modified since it was signed.
Go through these steps to verify a digitally signed PowerPoint presentation:
- Load the digitally signed PPT you want to verify through the Presentation class.
- Check whether the PowerPoint is signed.
- Check whether the signatures (used to sign the presentation) are valid.
This C# code shows you how to verify a digitally signed PowerPoint:
// Loads the presentation
using (Presentation pres = new Presentation("SomeSignedPresentation.pptx"))
{
if (pres.DigitalSignatures.Count > 0)
{
bool allSignaturesAreValid = true;
Console.WriteLine("Signatures used to sign the presentation: ");
// Checks whether all the digital signatures are valid
foreach (DigitalSignature signature in pres.DigitalSignatures)
{
Console.WriteLine(signature.Certificate.SubjectName.Name + ", "
+ signature.SignTime.ToString("yyyy-MM-dd HH:mm") + " -- " + (signature.IsValid ? "VALID" : "INVALID"));
allSignaturesAreValid &= signature.IsValid;
}
if (allSignaturesAreValid)
Console.WriteLine("Presentation is genuine. All signatures are valid.");
else
Console.WriteLine("Presentation has been modified since signing.");
}
}
Get a Free License
Want to test out Aspose.Slides features without limitations? Get a free temporary license.
Conclusion
In this article, we showed you how to add digital signatures to PowerPoint presentations in C# using a powerful .NET library. You may be interested in learning how to password protect a PowerPoint presentation.
To learn more about Aspose.Slides features, see our documentation. If you have questions, you can post them on our forum.