Skip to content
Guides

Trust Certificate

Trusting certificates involve two steps:

  1. Specify the trust path (folder) for certificates. This path serves as the location where certificates are placed when they are trusted. Additionally, when checking the trustworthiness of certificates, the SDK will look for the corresponding certificates within this folder. Please ensure that this path is valid. If the path does not exist or is inaccessible, the ComPDFKit SDK will not automatically create the trust path folder.

  2. Execute the method to trust certificates, and the certificates will be added to the trust path.

This example shows how to trust certificates:

C#
CPDFSignature signature = document.GetSignatureList()[0];
            CPDFSignatureCertificate signatureCertificate = signature.SignerList[0].CertificateList[0];
 Console.WriteLine("Certificate trusted status: " + signatureCertificate.IsTrusted.ToString());
Console.WriteLine("---Begin trusted---");
string trustedFolder = AppDomain.CurrentDomain.BaseDirectory + @"\TrustedFolder\";
if (!Directory.Exists(trustedFolder))
{
    Directory.CreateDirectory(trustedFolder);
}
// Set your trust path as a folder path.
CPDFSignature.SignCertTrustedFolder = trustedFolder;
// Add your certificate to the trust path.
signatureCertificate.AddToTrustedCertificates();
Console.WriteLine("Certificate trusted status: " + signatureCertificate.IsTrusted.ToString());