Skip to content

Commit

Permalink
845229_sample : print the certificate value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sri-hari-haran-g committed Sep 1, 2023
1 parent 22eb64c commit 49feeaa
Showing 1 changed file with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,38 @@
//Gets signer certificates
PdfSignerCertificate[] certifcate = result.TimeStampInformation.SignerCertificates;
//Print the certifcate value
for(int i = 0;i < certifcate.Length; i++)
foreach (PdfSignerCertificate signerCertificate in certifcate)
{
Console.WriteLine(certifcate[i].Certificate);
if (signerCertificate.OcspCertificate != null)
{
Console.WriteLine("------------OCSP Certificate-------------");
Console.WriteLine();
foreach (X509Certificate2 item in signerCertificate.OcspCertificate.Certificates)
{
Console.WriteLine("The OCSP Response was signed by " + item.SubjectName.Name);
}
Console.WriteLine("Is Embedded: " + signerCertificate.OcspCertificate.IsEmbedded);
Console.WriteLine("ValidFrom: " + signerCertificate.OcspCertificate.ValidFrom);
Console.WriteLine("ValidTo: " + signerCertificate.OcspCertificate.ValidTo);
Console.WriteLine();
continue;
}
if (signerCertificate.CrlCertificate != null)
{
Console.WriteLine("------------CRL Certificate--------------");
Console.WriteLine();
foreach (X509Certificate2 item in signerCertificate.CrlCertificate.Certificates)
{
if (item != null)
{
Console.WriteLine("The CRL was signed by " + item.SubjectName.Name);
}
}
Console.WriteLine("Is Embedded: " + signerCertificate.CrlCertificate.IsEmbedded);
Console.WriteLine("ValidFrom: " + signerCertificate.CrlCertificate.ValidFrom);
Console.WriteLine("ValidTo: " + signerCertificate.CrlCertificate.ValidTo);
break;
}
}
//Close the document.
document.Close(true);

0 comments on commit 49feeaa

Please sign in to comment.