menu

Xamarin.Forms

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

    Show / Hide Table of Contents

    Class TimeStampInformation

    Specifies the timestamp information from the signature

    Inheritance
    System.Object
    TimeStampInformation
    Namespace: Syncfusion.Pdf.Security
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class TimeStampInformation : Object
    Examples
    // Loads an existing document
    PdfLoadedDocument document = new PdfLoadedDocument(fileName);
    // Gets the signature field
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    // Validate signature and get validation result
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    // Gets the timestamp information from the signature
    TimeStampInformation timeStampInformation = result.TimeStampInformation;
    // Close the document
    document.Close(true);
    ' Loads an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
    ' Gets the signature field
    Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
    ' Validate signature and get validation result
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    ' Gets the timestamp information from the signature
    Dim timeStampInformation As TimeStampInformation = result.TimeStampInformation
    ' Close the document
    document.Close(true)

    Constructors

    TimeStampInformation()

    Declaration
    public TimeStampInformation()

    Properties

    Certificate

    Gets the timestamp certificate.

    Declaration
    public X509Certificate2 Certificate { get; }
    Property Value
    Type
    System.Security.Cryptography.X509Certificates.X509Certificate2
    Examples
    // Loads an existing document
    PdfLoadedDocument document = new PdfLoadedDocument(fileName);
    // Gets the signature field
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    // Validate signature and get validation result
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    // Gets the timestamp information from the signature
    TimeStampInformation timeStampInformation = result.TimeStampInformation;
    // Checks whether the signature signed with timestamp alone
    bool documentTimeStamp = timeStampInformation.IsDocumentTimeStamp;
    //Gets the timestamp certificate.
    X509Certificate2 certificate2 = result.TimeStampInformation.Certificate;
    // Close the document
    document.Close(true);
    ' Loads an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
    ' Gets the signature field
    Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
    ' Validate signature and get validation result
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    ' Gets the timestamp information from the signature
    Dim timeStampInformation As TimeStampInformation = result.TimeStampInformation
    ' Checks whether the signature signed with timestamp alone
    Dim documentTimeStamp As Boolean = timeStampInformation.IsDocumentTimeStamp
    'Gets the timestamp certificate.
    Dim certificate2 AS X509Certificate2 = result.TimeStampInformation.Certificate
    ' Close the document
    document.Close(true)

    IsDocumentTimeStamp

    Checks whether the signature signed with timestamp alone

    Declaration
    public bool IsDocumentTimeStamp { get; }
    Property Value
    Type
    System.Boolean
    Examples
    // Loads an existing document
    PdfLoadedDocument document = new PdfLoadedDocument(fileName);
    // Gets the signature field
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    // Validate signature and get validation result
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    // Gets the timestamp information from the signature
    TimeStampInformation timeStampInformation = result.TimeStampInformation;
    // Checks whether the signature signed with timestamp alone
    bool documentTimeStamp = timeStampInformation.IsDocumentTimeStamp;
    // Close the document
    document.Close(true);
    ' Loads an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
    ' Gets the signature field
    Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
    ' Validate signature and get validation result
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    ' Gets the timestamp information from the signature
    Dim timeStampInformation As TimeStampInformation = result.TimeStampInformation
    ' Checks whether the signature signed with timestamp alone
    Dim documentTimeStamp As Boolean = timeStampInformation.IsDocumentTimeStamp
    ' Close the document
    document.Close(true)

    IsValid

    Checks whether the timestamp is valid or not

    Declaration
    public bool IsValid { get; }
    Property Value
    Type
    System.Boolean
    Examples
    // Loads an existing document
    PdfLoadedDocument document = new PdfLoadedDocument(fileName);
    // Gets the signature field
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    // Validate signature and get validation result
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    // Gets the timestamp information from the signature
    TimeStampInformation timeStampInformation = result.TimeStampInformation;
    // Checks whether the timestamp is valid or not
    bool isValid = timeStampInformation.IsValid;
    // Close the document
    document.Close(true);
    ' Loads an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
    ' Gets the signature field
    Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
    ' Validate signature and get validation result
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    ' Gets the timestamp information from the signature
    Dim timeStampInformation As TimeStampInformation = result.TimeStampInformation
    ' Checks whether the timestamp is valid or not
    Dim isValid As Boolean = timeStampInformation.IsValid
    ' Close the document
    document.Close(true)

    SignerCertificates

    Gets an array of PdfSignerCertificate objects that represent the certificates belonging to the signers associated with the signature timestamp.

    Declaration
    public PdfSignerCertificate[] SignerCertificates { get; }
    Property Value
    Type
    PdfSignerCertificate[]
    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.TimeStampInformation.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.TimeStampInformation.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)

    Time

    Gets the timestamp time

    Declaration
    public DateTime Time { get; }
    Property Value
    Type
    System.DateTime
    Examples
    // Loads an existing document
    PdfLoadedDocument document = new PdfLoadedDocument(fileName);
    // Gets the signature field
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    // Validate signature and get validation result
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    // Gets the timestamp information from the signature
    TimeStampInformation timeStampInformation = result.TimeStampInformation;
    // Gets the timestamp time
    DateTime timeStampTime = timeStampInformation.Time;
    // Close the document
    document.Close(true);
    ' Loads an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
    ' Gets the signature field
    Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
    ' Validate signature and get validation result
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    ' Gets the timestamp information from the signature
    Dim timeStampInformation As TimeStampInformation = result.TimeStampInformation
    ' Gets the timestamp time
    Dim timeStampTime As DateTime = timeStampInformation.Time
    ' Close the document
    document.Close(true)

    TimeStampPolicyId

    Gets the timestamp policy ID

    Declaration
    public string TimeStampPolicyId { get; }
    Property Value
    Type
    System.String
    Examples
    // Loads an existing document
    PdfLoadedDocument document = new PdfLoadedDocument(fileName);
    // Gets the signature field
    PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
    // Validate signature and get validation result
    PdfSignatureValidationResult result = signatureField.ValidateSignature();
    // Gets the timestamp information from the signature
    TimeStampInformation timeStampInformation = result.TimeStampInformation;
    // Gets the timestamp policy ID
    string timeStampPolicyId = timeStampInformation.TimeStampPolicyId;
    // Close the document
    document.Close(true);
    ' Loads an existing document
    Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
    ' Gets the signature field
    Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
    ' Validate signature and get validation result
    Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
    ' Gets the timestamp information from the signature
    Dim timeStampInformation As TimeStampInformation = result.TimeStampInformation
    ' Gets the timestamp policy ID
    Dim timeStampPolicyId As string = timeStampInformation.TimeStampPolicyId
    ' Close the document
    document.Close(true)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved