Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
特定の署名を使用してPDFファイルが署名されているかどうかを確認するには、PdfFileSignatureクラスのVerifySignedメソッドを使用します。このメソッドは署名名を必要とし、その署名名を使用してPDFが署名されている場合はtrueを返します。また、どの署名で署名されているかを確認せずにPDFが署名されているかを確認することも可能です。
以下のコードスニペットは、特定の署名を使用してPDFが署名されているかどうかを確認する方法を示しています。
// 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");
}
}
}
署名名を提供せずにファイルが署名されているかどうかを判断するには、以下のコードを使用します。
// 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メソッドは、PdfFileSignatureクラスの特定の署名を検証するために使用されます。このメソッドは署名名を入力として必要とし、署名が有効な場合はtrueを返します。以下のコードスニペットは、署名を検証する方法を示しています。
// 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.