C# 코드를 사용하여 PPT에서 디지털 서명 추가 또는 삭제
디지털 서명은 종이에 펜으로 수기 서명하는 현대적인 대안입니다. 이는 고급 수학 기술을 사용하여 디지털 문서의 진위와 무결성을 검증함으로써, 문서의 내용이 서명자에게서 왔으며 서명 이후 변경되지 않았음을 보장합니다. 경우에 따라 기밀 정보를 포함한 PowerPoint 문서에는 서명이 필요할 수 있습니다. 이 글에서는 Spire.Presentation for .NET을 사용하여 PowerPoint에서 프로그래밍 방식으로 디지털 서명을 추가하거나 삭제하는 방법을 소개합니다.
Spire.Presentation for .NET 설치
먼저, Spire.Presentation for .NET 패키지에 포함된 DLL 파일을 .NET 프로젝트의 참조로 추가해야 합니다. DLL 파일은 이 링크에서 다운로드하거나 NuGet을 통해 설치할 수 있습니다.
PM> Install-Package Spire.PresentationC# 및 VB.NET에서 PowerPoint에 디지털 서명 추가
디지털 서명을 추가하려면 먼저 유효한 서명 인증서가 필요합니다. 그런 다음 Presentation.AddDigitalSignature(X509Certificate2 certificate, string comments, DateTime signTime) 메서드를 사용하여 해당 인증서를 이용해 PowerPoint 문서에 디지털 서명을 추가할 수 있습니다.
using Spire.Presentation;
using System;
using System.Security.Cryptography.X509Certificates;
namespace AddDigitalSignature
{
class Program
{
static void Main(string[] args)
{
// Presentation 인스턴스 생성
Presentation ppt = new Presentation();
// PowerPoint 문서 불러오기
ppt.LoadFromFile("input.pptx");
// 인증서 불러오기
X509Certificate2 x509 = new X509Certificate2("gary.pfx", "e-iceblue");
// 디지털 서명 추가
ppt.AddDigitalSignature(x509, "e-iceblue", DateTime.Now);
// 결과 문서 저장
ppt.SaveToFile("AddDigitalSignature.pptx", FileFormat.Pptx2013);
}
}
}C# 및 VB.NET에서 PowerPoint에서 모든 디지털 서명 제거
경우에 따라 PowerPoint 문서에서 디지털 서명을 제거해야 할 수 있습니다. Spire.Presentation for .NET은 Presentation.RemoveAllDigitalSignatures() 메서드를 제공하여 모든 디지털 서명을 한 번에 제거할 수 있습니다.
using Spire.Presentation;
namespace RemoveDigitalSignature
{
class Program
{
static void Main(string[] args)
{
// Presentation 인스턴스 생성
Presentation ppt = new Presentation();
// PowerPoint 문서 불러오기
ppt.LoadFromFile("AddDigitalSignature.pptx");
// 문서에 디지털 서명이 있는지 확인
if (ppt.IsDigitallySigned == true)
{
// 모든 디지털 서명 제거
ppt.RemoveAllDigitalSignatures();
}
// 결과 문서 저장
ppt.SaveToFile("RemoveDigitalSignature.pptx", FileFormat.Pptx2013);
}
}
}임시 라이선스 신청
생성된 문서에서 평가 메시지를 제거하거나 기능 제한을 해제하려면, 30일간 사용할 수 있는 체험 라이선스를 신청하십시오.