menu

Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfRevocationCertificate - Xamarin.Android API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfRevocationCertificate

    The PdfRevocationCertificate class represents a revocation certificate used in PDF signing operations. It contains information related to the revocation status of a signer's certificate.

    Inheritance
    System.Object
    PdfRevocationCertificate
    Namespace: Syncfusion.Pdf.Security
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfRevocationCertificate : Object

    Constructors

    PdfRevocationCertificate()

    Declaration
    public PdfRevocationCertificate()

    Properties

    Certificates

    Gets the certificate associated with the revocation certificate.

    Declaration
    public X509Certificate2[] Certificates { get; }
    Property Value
    Type
    System.Security.Cryptography.X509Certificates.X509Certificate2[]
    Examples
    //Loads an existing document.
    PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
    //Gets the signature field.
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    //Validates signature and gets the validation result.
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    //Gets signer certificates
    PdfSignerCertificate[] certifcate = result.SignerCertificates;
    foreach (PdfSignerCertificate cert in certifcate)
    {
        //Get the actual signer certificate.
        X509Certificate2 actualCertificate = cert.Certificate;                
        //Get the OCSP certificate.
        PdfRevocationCertificate ocspCertificate = cert.OcspCertificate;
        if (ocspCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isOcspEmbedded = ocspCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 ocsPCert = ocspCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = ocspCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = ocspCertificate.ValidTo;                    
        }
        //Get the CRL certificate.
        PdfRevocationCertificate crlCertificate = cert.CrlCertificate;
        if (crlCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isCrlEmbedded = crlCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 crlCert = crlCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = crlCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = crlCertificate.ValidTo;
        }
    }
    //Close the document.
    document.Close(true);
    Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    Dim signatureField As PdfLoadedSignatureField = CType(document.Form.Fields(0),PdfLoadedSignatureField)
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature
    Dim certifcate() As PdfSignerCertificate = result.SignerCertificates
    For Each cert As PdfSignerCertificate In certifcate
        'Get the actual signer certificate.
        Dim actualCertificate As X509Certificate2 = cert.Certificate
        'Get the OCSP certificate.
        Dim ocspCertificate As PdfRevocationCertificate = cert.OcspCertificate
        If (Not (ocspCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isOcspEmbedded As Boolean = ocspCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim ocsPCert As X509Certificate2 = ocspCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = ocspCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = ocspCertificate.ValidTo
        End If
        'Get the CRL certificate.
        Dim crlCertificate As PdfRevocationCertificate = cert.CrlCertificate
        If (Not (crlCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isCrlEmbedded As Boolean = crlCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim crlCert As X509Certificate2 = crlCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = crlCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = crlCertificate.ValidTo
        End If    
    Next
    'Close the document.
    document.Close(true)

    IsEmbedded

    Gets a value indicating whether the revocation certificate is embedded within the PDF document.

    Declaration
    public bool IsEmbedded { get; }
    Property Value
    Type
    System.Boolean
    Examples
    //Loads an existing document.
    PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
    //Gets the signature field.
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    //Validates signature and gets the validation result.
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    //Gets signer certificates
    PdfSignerCertificate[] certifcate = result.SignerCertificates;
    foreach (PdfSignerCertificate cert in certifcate)
    {
        //Get the actual signer certificate.
        X509Certificate2 actualCertificate = cert.Certificate;                
        //Get the OCSP certificate.
        PdfRevocationCertificate ocspCertificate = cert.OcspCertificate;
        if (ocspCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isOcspEmbedded = ocspCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 ocsPCert = ocspCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = ocspCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = ocspCertificate.ValidTo;                    
        }
        //Get the CRL certificate.
        PdfRevocationCertificate crlCertificate = cert.CrlCertificate;
        if (crlCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isCrlEmbedded = crlCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 crlCert = crlCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = crlCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = crlCertificate.ValidTo;
        }
    }
    //Close the document.
    document.Close(true);
    Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    Dim signatureField As PdfLoadedSignatureField = CType(document.Form.Fields(0),PdfLoadedSignatureField)
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature
    Dim certifcate() As PdfSignerCertificate = result.SignerCertificates
    For Each cert As PdfSignerCertificate In certifcate
        'Get the actual signer certificate.
        Dim actualCertificate As X509Certificate2 = cert.Certificate
        'Get the OCSP certificate.
        Dim ocspCertificate As PdfRevocationCertificate = cert.OcspCertificate
        If (Not (ocspCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isOcspEmbedded As Boolean = ocspCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim ocsPCert As X509Certificate2 = ocspCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = ocspCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = ocspCertificate.ValidTo
        End If
        'Get the CRL certificate.
        Dim crlCertificate As PdfRevocationCertificate = cert.CrlCertificate
        If (Not (crlCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isCrlEmbedded As Boolean = crlCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim crlCert As X509Certificate2 = crlCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = crlCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = crlCertificate.ValidTo
        End If    
    Next
    'Close the document.
    document.Close(true)

    IsRevokedCRL

    Gets a value indicating whether the CRL certificate is revoked or not.

    Declaration
    public bool IsRevokedCRL { get; }
    Property Value
    Type
    System.Boolean
    Examples
    //Loads an existing signed PDF document.
    PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
    //Gets the signature field. 
    PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
    //Validate signature and gets the validation result.
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    //Gets signer certificates.
    PdfSignerCertificate[] signerCertificates = result.SignerCertificates;
    foreach (PdfSignerCertificate signerCertificate in signerCertificates)
    {
      if (signerCertificate.CrlCertificate != null)
      {
        //Gets the value indicating whether the CRL certificated is revoked or not. 
        bool isRevoked = signerCertificate.CrlCertificate.IsRevokedCRL;
      }
    }
    //Close the document.
    loadedDocument.Close(true);
    'Gets the value indicating whether the CRL certificated is revoked or not.
    Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    'Gets the signature field. 
    Dim signatureField As PdfLoadedSignatureField = TryCast(loadedDocument.Form.Fields(0), PdfLoadedSignatureField)
    'Validate signature and gets the validation result.
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    'Gets signer certificates.
    Dim signerCertificates As PdfSignerCertificate() = result.SignerCertificates
    For Each signerCertificate As PdfSignerCertificate In signerCertificates
     If signerCertificate.CrlCertificate IsNot Nothing Then
      'Gets the value indicating whether the CRL certificated is revoked or not.
      Dim isRevoked As Boolean = signerCertificate.CrlCertificate.IsRevokedCRL
     End If
    Next
    'Close the document.
    loadedDocument.Close(True)

    RevokedCertificates

    Retrieve the list of revoked certificates from every Certificate Revocation List (CRL).

    Declaration
    public RevokedCertificate[] RevokedCertificates { get; }
    Property Value
    Type
    RevokedCertificate[]
    Examples
    //Loads an existing signed PDF document.
    PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
    //Gets the signature field. 
    PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
    Validate signature and gets the validation result.
    PdfSignatureValidationResult result = signatureField.ValidateSignature();   
    //Gets signer certificates.
    PdfSignerCertificate[] signerCertificates = result.SignerCertificates;
    foreach (PdfSignerCertificate signerCertificate in signerCertificates)
    {
      if (signerCertificate.CrlCertificate != null)
      {
        //Gets the list of revoked certficates.
        RevokedCertificate[] revokedCertificates = signerCertificate.CrlCertificate.RevokedCertificates;
        if (revokedCertificates != null)
        {
         //Gets a serial number of the revoked certificate.
         string serialNumber = revokedCertificates[0].SerialNumber;
         //Gets a revoked date of the specific revoked certificate.
         DateTime revokedDate = revokedCertificates[0].ValidTo;
        }
      }
    }
    //Close the document.
    loadedDocument.Close(true);
    'Loads an existing signed PDF document.
    Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    'Gets the signature field. 
    Dim signatureField As PdfLoadedSignatureField = TryCast(loadedDocument.Form.Fields(0), PdfLoadedSignatureField)
    'Validate signature and gets the validation result.
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    'Gets signer certificates.
    Dim signerCertificates As PdfSignerCertificate() = result.SignerCertificates
    For Each signerCertificate As PdfSignerCertificate In signerCertificates
      If signerCertificate.CrlCertificate IsNot Nothing Then
       'Gets the list of revoked certficates.
       Dim revokedCertificates As RevokedCertificate() = signerCertificate.CrlCertificate.RevokedCertificates
        If revokedCertificates IsNot Nothing Then
         'Gets a serial number of the revoked certificate.
         Dim serialNumber As String = revokedCertificates(0).SerialNumber
         'Gets a revoked date of the specific revoked certificate.   
         Dim revokedDate As DateTime = revokedCertificates(0).ValidTo
       End If
     End If 
    Next
    'Close the document.
    loadedDocument.Close(True)

    ValidFrom

    Gets the date and time when the revocation certificate becomes valid.

    Declaration
    public DateTime ValidFrom { get; }
    Property Value
    Type
    System.DateTime
    Examples
    //Loads an existing document.
    PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
    //Gets the signature field.
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    //Validates signature and gets the validation result.
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    //Gets signer certificates
    PdfSignerCertificate[] certifcate = result.SignerCertificates;
    foreach (PdfSignerCertificate cert in certifcate)
    {
        //Get the actual signer certificate.
        X509Certificate2 actualCertificate = cert.Certificate;                
        //Get the OCSP certificate.
        PdfRevocationCertificate ocspCertificate = cert.OcspCertificate;
        if (ocspCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isOcspEmbedded = ocspCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 ocsPCert = ocspCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = ocspCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = ocspCertificate.ValidTo;                    
        }
        //Get the CRL certificate.
        PdfRevocationCertificate crlCertificate = cert.CrlCertificate;
        if (crlCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isCrlEmbedded = crlCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 crlCert = crlCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = crlCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = crlCertificate.ValidTo;
        }
    }
    //Close the document.
    document.Close(true);
    Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    Dim signatureField As PdfLoadedSignatureField = CType(document.Form.Fields(0),PdfLoadedSignatureField)
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature
    Dim certifcate() As PdfSignerCertificate = result.SignerCertificates
    For Each cert As PdfSignerCertificate In certifcate
        'Get the actual signer certificate.
        Dim actualCertificate As X509Certificate2 = cert.Certificate
        'Get the OCSP certificate.
        Dim ocspCertificate As PdfRevocationCertificate = cert.OcspCertificate
        If (Not (ocspCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isOcspEmbedded As Boolean = ocspCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim ocsPCert As X509Certificate2 = ocspCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = ocspCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = ocspCertificate.ValidTo
        End If
        'Get the CRL certificate.
        Dim crlCertificate As PdfRevocationCertificate = cert.CrlCertificate
        If (Not (crlCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isCrlEmbedded As Boolean = crlCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim crlCert As X509Certificate2 = crlCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = crlCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = crlCertificate.ValidTo
        End If    
    Next
    'Close the document.
    document.Close(true)

    ValidTo

    Gets the date and time when the revocation certificate expires.

    Declaration
    public DateTime ValidTo { get; }
    Property Value
    Type
    System.DateTime
    Examples
    //Loads an existing document.
    PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
    //Gets the signature field.
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    //Validates signature and gets the validation result.
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    //Gets signer certificates
    PdfSignerCertificate[] certifcate = result.SignerCertificates;
    foreach (PdfSignerCertificate cert in certifcate)
    {
        //Get the actual signer certificate.
        X509Certificate2 actualCertificate = cert.Certificate;                
        //Get the OCSP certificate.
        PdfRevocationCertificate ocspCertificate = cert.OcspCertificate;
        if (ocspCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isOcspEmbedded = ocspCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 ocsPCert = ocspCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = ocspCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = ocspCertificate.ValidTo;                    
        }
        //Get the CRL certificate.
        PdfRevocationCertificate crlCertificate = cert.CrlCertificate;
        if (crlCertificate != null)
        {
            //Gets a value indicating whether the revocation certificate is embedded within the PDF document
            bool isCrlEmbedded = crlCertificate.IsEmbedded;
            //Gets the certificate associated with the revocation certificate
            X509Certificate2 crlCert = crlCertificate.Certificates[0];
            //Gets the date and time when the revocation certificate becomes valid
            DateTime currentUpdate = crlCertificate.ValidFrom;
            //Gets the date and time when the revocation certificate expires
            DateTime nextUpdate = crlCertificate.ValidTo;
        }
    }
    //Close the document.
    document.Close(true);
    Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
    Dim signatureField As PdfLoadedSignatureField = CType(document.Form.Fields(0),PdfLoadedSignatureField)
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature
    Dim certifcate() As PdfSignerCertificate = result.SignerCertificates
    For Each cert As PdfSignerCertificate In certifcate
        'Get the actual signer certificate.
        Dim actualCertificate As X509Certificate2 = cert.Certificate
        'Get the OCSP certificate.
        Dim ocspCertificate As PdfRevocationCertificate = cert.OcspCertificate
        If (Not (ocspCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isOcspEmbedded As Boolean = ocspCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim ocsPCert As X509Certificate2 = ocspCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = ocspCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = ocspCertificate.ValidTo
        End If
        'Get the CRL certificate.
        Dim crlCertificate As PdfRevocationCertificate = cert.CrlCertificate
        If (Not (crlCertificate) Is Nothing) Then
            'Gets a value indicating whether the revocation certificate is embedded within the PDF document
            Dim isCrlEmbedded As Boolean = crlCertificate.IsEmbedded
            'Gets the certificate associated with the revocation certificate
            Dim crlCert As X509Certificate2 = crlCertificate.Certificates(0)
            'Gets the date and time when the revocation certificate becomes valid
            Dim currentUpdate As DateTime = crlCertificate.ValidFrom
            'Gets the date and time when the revocation certificate expires
            Dim nextUpdate As DateTime = crlCertificate.ValidTo
        End If    
    Next
    'Close the document.
    document.Close(true)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved