Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
To verify whether a PDF file is signed using a particular signature, use the VerifySigned method of the PdfFileSignature class. This method requires the signature name and returns true if the PDF is signed using that signature name. It is also possible to verify that a PDF is signed, without verifying which signature it is signed with.
The following code snippet shows you how to verify whether PDF is signed using a given signature.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void IsPdfSigned()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_SecuritySignatures();
using (var pdFileSignature = new Aspose.Pdf.Facades.PdfFileSignature())
{
// Bind PDF document
pdFileSignature.BindPdf(dataDir + "signed_rsa.pdf");
if (pdFileSignature.ContainsSignature())
{
Console.WriteLine("Document Signed");
}
}
}
To determine if a file is singed, without providing the signature name, use the following code.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void IsPdfSignedWithGivenSignature()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_SecuritySignatures();
using (var pdFileSignature = new Aspose.Pdf.Facades.PdfFileSignature())
{
// Bind PDF document
pdFileSignature.BindPdf(dataDir + "signed_rsa.pdf");
if (pdFileSignature.VerifySignature("Signature1"))
{
Console.WriteLine("PDF Signed");
}
}
}
VerifySignature method of PdfFileSignature class allows you to validate a particular signature. This method requires signature name as input and returns true if the signature is valid. The following code snippet shows you how to validate a signature.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void IsPdfSignatureValid()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_SecuritySignatures();
using (var pdFileSignature = new Aspose.Pdf.Facades.PdfFileSignature())
{
// Bind PDF document
pdFileSignature.BindPdf(dataDir + "signed_rsa.pdf");
if (pdFileSignature.VerifySignature("Signature1"))
{
Console.WriteLine("Signature Verified");
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.