翻譯|使用教程|編輯:胡濤|2022-10-09 10:49:04.243|閱讀 258 次
概述:在本文中,您將學(xué)習(xí)如何使用 C# 向 PowerPoint 添加數(shù)字簽名。歡迎查閱~
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Aspose.Slides for .NET是一款.NET PowerPoint管理API,用于讀取,編寫,操作和轉(zhuǎn)換PowerPoint幻燈片的獨(dú)立API,可將PowerPoint轉(zhuǎn)換為PDF,PDF/A,XPS,TIFF,HTML,ODP和其他PowerPoint格式。
數(shù)字簽名是用于驗(yàn)證數(shù)字文檔的真實(shí)性和完整性的電子簽名。當(dāng)您以數(shù)字方式簽署文檔時(shí),簽名將作為確認(rèn)該文檔來自您并且自您簽署以來沒有更改過。
在本文中,您將學(xué)習(xí)如何使用 C# 向 PowerPoint 添加數(shù)字簽名。
Microsoft PowerPoint 應(yīng)用程序提供允許用戶將數(shù)字簽名添加到其 PPT 和 PPTX 演示文稿的功能。
但是,要在 C# 中為 PowerPoint PPT 或 PPTX 添加數(shù)字簽名,您必須使用Aspose.Slides for .NET。后者是一個(gè) PowerPoint 庫,允許您使用簡單的代碼行創(chuàng)建、修改和操作演示文稿。
此外,要將數(shù)字簽名附加到 PowerPoint 文檔,您需要簽名或數(shù)字證書。此類證書可識(shí)別并證明您的身份。您可以創(chuàng)建自己的證書,也可以從證書頒發(fā)機(jī)構(gòu)(頒發(fā)證書)處獲得證書。
當(dāng)您向某人發(fā)送經(jīng)過數(shù)字簽名的 PowerPoint 演示文稿時(shí),您實(shí)際上是在向該人發(fā)送您的證書和公鑰。
假設(shè)您有一個(gè)可以使用的數(shù)字證書,您可以通過以下步驟為您的 PowerPoint 演示文稿添加數(shù)字簽名:
此 C# 代碼向您展示如何將數(shù)字簽名添加到 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); }
除了向 PowerPoint PPT 添加數(shù)字簽名外,Aspose.Slides for .NET還允許您驗(yàn)證數(shù)字簽名的演示文稿。驗(yàn)證操作實(shí)質(zhì)上是檢查演示文稿自簽名后是否已被修改。
通過這些步驟來驗(yàn)證數(shù)字簽名的 PowerPoint 演示文稿:
此 C# 代碼向您展示如何驗(yàn)證數(shù)字簽名的 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); }
以上便是如何在 C# 中將數(shù)字簽名添加到 PowerPoint,如您還有關(guān)于產(chǎn)品相關(guān)方面的疑問,可以繼續(xù)瀏覽本系列其他內(nèi)容,也歡迎您加入我們的交流群發(fā)表您遇到的問題。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn