Learn how to add and verify digital signatures in PowerPoint PPT in Python:
Last active
January 21, 2022 09:43
-
-
Save aspose-com-gists/e85c3aff6d89f31923cc608394e28090 to your computer and use it in GitHub Desktop.
Add Digital Signature to PowerPoint PPT in Python
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
import aspose.slides as slides | |
# Load presentation | |
with slides.Presentation("presentation.pptx") as pres: | |
# Create DigitalSignature object with PFX file and PFX password | |
signature = slides.DigitalSignature("certificate.pfx", "password") | |
# Comment new digital signature | |
signature.comments = "Signing with Aspose.Slides" | |
# Add digital signature to presentation | |
pres.digital_signatures.add(signature) | |
# Save presentation | |
pres.save("SignedPPT.pptx", slides.export.SaveFormat.PPTX) |
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
import aspose.slides as slides | |
# Load presentation | |
with slides.Presentation("presentation.pptx") as pres: | |
if len(pres.digital_signatures) > 0: | |
allSignaturesAreValid = True | |
print("Signatures used to sign the presentation: ") | |
# Check if all digital signatures are valid | |
for signature in pres.digital_signatures : | |
print(signature.certificate.subject_name.name + ", " | |
+ signature.sign_time.strftime("yyyy-MM-dd HH:mm") + " -- " + "VALID" if signature.is_valid else "INVALID") | |
allSignaturesAreValid = allSignaturesAreValid and signature.is_valid | |
if allSignaturesAreValid: | |
print("Presentation is original, all signatures are valid.") | |
else: | |
print("Presentation has been modified.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment