A password is a common protection scheme used to protect files or data against unauthorized access. If you want only select people to be able to access or open your PowerPoint, you can encrypt and lock the presentation file with a password.
In this article, you will learn how to encrypt a PowerPoint in C#. We will also provide instructions on decrypting presentations and related procedures.
C# API to Encrypt and Decrypt PPT
Developers and applications use Aspose.Slides for .NET to create, read, edit, convert, and manipulate PowerPoint presentations (without Microsoft PowerPoint or Office). Aspose.Slides makes it very easy to perform encryption and decryption tasks involving presentations.
Go through the steps in this Installation guide. Once you install Aspose.Slides, move on to the next section.
C# Encrypt PowerPoint PPT with Password
When you encrypt and lock a presentation with a password, only authorized people (who know the correct password) get to open the presentation. If your presentation contains sensitive information, this encryption procedure is probably the protection scheme you will want to consider.
- Create an instance of the
Presentation
class and load the presentation you want to encrypt. - Call the
Encrypt
method and pass the password you want to set. - Save the modified presentation.
Set Write Protection to Discourage Modification
A presentation with the “Do not modify” message may prove sufficient in discouraging viewers from editing a presentation. This message serves the same purpose if you want to tell those viewers the presentation you provided is the final version.
- Create an instance of the
Presentation
class and load the presentation you want to encrypt. - Call the
SetWriteProtection
method and pass your preferred password. - Save the modified presentation.
Note: When you set this write protection to a presentation, a strong-willed individual may proceed to modify the presentation.
Decrypt PowerPoint PPT in C#
When you need to work with an encrypted presentation, you have to decrypt the presentation first by passing the password that was used to lock the presentation in the first place.
- Create an instance of the
LoadOptions
class and pass the password for the presentation. - Create an instance of the
Presentation
class and load the presentation you want to decrypt. - Do some work with the presentation.
Remove Encryption to Disable Password Protection
By removing the encryption from a password-protected PowerPoint presentation, you get to obtain a regular presentation (without restrictions). If you no longer see reason to lock a presentation, it makes sense to disable the password protection for good so that everyone can view its contents.
Here too, to remove a presentation’s encryption, you must know and provide the password used to encrypt it.
- Create an instance of the
LoadOptions
class and pass the password for the presentation. - Create an instance of the
Presentation
class and load the presentation whose protection you want to remove. - Call the
RemoveEncryption
method. - Save the modified presentation.
Get a Free License
Want to try out Aspose.Slides features without limitations? Get a free temporary license.
Conclusion
Having learned how to encrypt and decrypt PowerPoint presentations to protect them against unauthorized access, you may be interested in other security-related operations. We recommend you see the Password Protected Presentation article in our documentation.
To learn more about Aspose.Slides features, go through our documentation. If you have questions, you can post them on our forum.