翻譯|使用教程|編輯:李顯亮|2021-04-01 09:41:31.303|閱讀 206 次
概述:在演示文稿包含要保護(hù)的機(jī)密信息的情況下,用密碼保護(hù)演示文件可能會(huì)有所幫助。有鑒于此,本文將教您如何使用C ++通過(guò)密碼或數(shù)字簽名保護(hù)PowerPoint演示文稿。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
Microsoft PowerPoint是功能強(qiáng)大且功能豐富的軟件,可讓您創(chuàng)建令人驚嘆的幻燈片以用于會(huì)議和討論。在演示文稿包含要保護(hù)的機(jī)密信息的情況下,用密碼保護(hù)演示文件可能會(huì)有所幫助。另一方面,如果想將演示文稿標(biāo)記為最終演示并且不希望修改其內(nèi)容,則可以對(duì)演示文稿文件進(jìn)行數(shù)字簽名。只要簽名有效,就可以確信演示文件沒(méi)有被更改。有鑒于此,本文將教您如何使用C ++通過(guò)密碼或數(shù)字簽名保護(hù)PowerPoint演示文稿。
Aspose.Slides for C ++是功能豐富的C ++庫(kù),可用于創(chuàng)建,讀取和修改PowerPoint文件。此外,API支持使用密碼和數(shù)字簽名保護(hù)PowerPoint文件。
>>你可以點(diǎn)擊這里下載Aspose.Slides 最新版測(cè)試體驗(yàn)。
以下是使用密碼保護(hù)PowerPoint演示文稿的步驟。
以下是使用C ++用密碼保護(hù)PowerPoint演示文稿的示例代碼。
// File paths const String sourceFilePath = u"SourceDirectory\\SamplePresentation.pptx"; const String outputFilePath = u"OutputDirectory\\protected-presentation.pptx"; // Load the presentation file SharedPtrpresentation = MakeObject(sourceFilePath); // Protect presentation with password presentation->get_ProtectionManager()->Encrypt(u"password"); // Save the presentation presentation->Save(outputFilePath, SaveFormat::Pptx);
以下是使用數(shù)字簽名保護(hù)PowerPoint演示文稿的步驟。
以下是使用C ++使用數(shù)字簽名保護(hù)PowerPoint文件的示例代碼。
// File paths const String sourceFilePath = u"SourceDirectory\\SamplePresentation.pptx"; const String signatureFilePath = u"SourceDirectory\\testsignature1.pfx"; const String outputFilePath = u"OutputDirectory\\digital-signature-presentation.pptx"; // Load the presentation file SharedPtrpresentation = MakeObject(sourceFilePath); // Create DigitalSignature object with PFX file and password SharedPtrsignature = MakeObject(signatureFilePath, u"testpass1"); // Add comment signature->set_Comments(u"Test Comments"); // Add digital signature to presentation presentation->get_DigitalSignatures()->Add(signature); // Save the presentation presentation->Save(outputFilePath, SaveFormat::Pptx);
Aspose.Slides for C ++ API還為您提供了驗(yàn)證經(jīng)過(guò)數(shù)字簽名的PowerPoint文件的功能。以下是驗(yàn)證PowerPoint文件的數(shù)字簽名的步驟。
以下是用于使用C ++驗(yàn)證PowerPoint文件的數(shù)字簽名的示例代碼。
// File path const String sourceFilePath = u"SourceDirectory\\digital-signature-presentation.pptx"; // Load the presentation file SharedPtrpresentation = MakeObject(sourceFilePath); // Check if presentation has digital signatures if (presentation->get_DigitalSignatures()->get_Count() > 0) { bool allSignaturesAreValid = true; Console::WriteLine(u"Signatures used to sign the presentation: "); // Verify digital signatures for (int i = 0; i < presentation->get_DigitalSignatures()->get_Count(); i++) { SharedPtrsignature = presentation->get_DigitalSignatures()->idx_get(i); Console::WriteLine(System::Convert::ToString(signature->get_SignTime()) + u" -- " + (signature->get_IsValid() ? u"VALID" : u"INVALID")); if (signature->get_IsValid() == false) { allSignaturesAreValid = false; } } if (allSignaturesAreValid) { Console::WriteLine(u"Presentation is genuine, all signatures are valid."); } else { Console::WriteLine(u"Presentation has been modified since signing."); } }
如果你想試用Aspose的全部完整功能,可 聯(lián)系在線客服獲取30天臨時(shí)授權(quán)體驗(yàn)。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn