Skip to main content

Certificate

Version: 11.0

cete.dynamicpdf.certificate

Certificate​

Represents a digital certificate.

public class Certificate
Public Class Certificate

Inheritance: Object → Certificate

Examples​

This example shows how to create a signature and sign it with a certificate.

Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.PageElements.Forms

Module MyModule

Sub Main()
'Create a PDF Document
Dim document As Document = New Document

'Create a Page
Dim page As Page = New Page

'Create a signature form field
Dim signature As Signature = New Signature("SigField", 10, 10, 250, 100)

' Add signature field to the page
page.Elements.Add(signature)

' Add the page to the document
document.Pages.Add(page)

'Create a Certificate from the file
Dim certificate As Certificate = New Certificate("C:\MyPersonalCertificate.pfx", "CertificatePassword")

' Certify the document referring the sign field
document.Certify("SigField", certificate, CertifyingPermission.NoChangesAllowed)

' Save the document
document.Draw("C:\MySignedDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements.Forms;

class MyClass
{
static void Main(string[] args)
{
// Create a PDF Document
Document document = new Document();

// Create a PDF Page
Page page = new Page();

// Create a signature form field
Signature signature = new Signature("SigField", 10, 10, 250, 100);

// Add signature field to the page
page.Elements.Add(signature);

// Add the page to the document
document.Pages.Add(page);

// Create a Certificate from the file
Certificate certificate = new Certificate(@"C:\MyPersonalCertificate.pfx", "CertificatePassword");

// Certify the document referring the sign field
document.Certify("SigField", certificate, CertifyingPermission.NoChangesAllowed);

// Save the document
document.Draw(@"C:\MySignedDocument.pdf");
}
}

Remarks​

NOTE: This class requires the .NET Framework 2.0 or greater and it is not available for .NET standard

Constructors​

Certificate(Byte[], String)​

Initializes a new instance of a Certificate from the given data.

public Certificate(Byte[] certificateData, string password)
Public Sub New (certificateData As Byte(), password As String)

Parameters​

Byte array containing the digital certificate with private key.

Password for the certificate.

Remarks​

NOTE: This class requires the .NET Framework 2.0 or greater.

Certificate(StoreName, StoreLocation, String)​

Initializes a new instance of a Certificate from the certificate store.

public Certificate(StoreName storeName, StoreLocation storeLocation, string certificateSubject)
Public Sub New (storeName As StoreName, storeLocation As StoreLocation, certificateSubject As String)

Parameters​

Value of type StoreName

Value of type StoreLocation

A portion or full subject string corresponds to fetch the certificate from store.

Remarks​

NOTE: This class requires the .NET Framework 2.0 or greater.

Certificate(String)​

Initializes a new instance of a Certificate from the certificate store.

public Certificate(string certificateSubject)
Public Sub New (certificateSubject As String)

Parameters​

A portion or full subject string corresponds to fetch the certificate from store.

Remarks​

NOTE: This class requires the .NET Framework 2.0 or greater.

Default certificate store will be used.

Certificate(String, StoreLocation, String)​

Initializes a new instance of a Certificate from the certificate store.

public Certificate(string storeName, StoreLocation storeLocation, string certificateSubject)
Public Sub New (storeName As String, storeLocation As StoreLocation, certificateSubject As String)

Parameters​

Store name where the certificate resides.

Value of type StoreLocation

A portion or full subject string corresponds to fetch the certificate from store.

Remarks​

NOTE: This class requires the .NET Framework 2.0 or greater.

Certificate(String, String)​

Initializes a new instance of a Certificate from the given file.

public Certificate(string certificatePath, string password)
Public Sub New (certificatePath As String, password As String)

Parameters​

Physical file path to a digital certificate with private key.

Password for the certificate.

Remarks​

NOTE: This class requires the .NET Framework 2.0 or greater.

Certificate(X509Certificate2)​

Initializes a new instance of a Certificate from an X509Certificate2 certificate class.

public Certificate(X509Certificate2 certificate)
Public Sub New (certificate As X509Certificate2)

Parameters​

A digital certificate with private key.

Remarks​

NOTE: This class requires the .NET Framework 2.0 or greater.

Properties​

IncludeWholeChain​

Specifies how much of the X.509 certificate chain should be included in the signed data. Default value is true. If it is false, include option will be EndCertOnly.

public bool IncludeWholeChain { get; set; }
Public Property IncludeWholeChain As Boolean

Property Value​

Boolean

Issuer​

Gets the complete issuer string from the certificate loaded.

public string Issuer { get; }
Public Property Issuer As String

Property Value​

String

SignatureType​

Gets or sets type of signature.

public SignatureType SignatureType { get; set; }
Public Property SignatureType As SignatureType

Property Value​

SignatureType

SignSilently​

Gets or sets to prompt for the selection of a signing Certificate.

public bool SignSilently { get; set; }
Public Property SignSilently As Boolean

Property Value​

Boolean

Subject​

Gets the complete subject string from the certificate loaded.

public string Subject { get; }
Public Property Subject As String

Property Value​

String

SubjectName​

Gets the subject name of the certificate loaded.

public string SubjectName { get; }
Public Property SubjectName As String

Property Value​

String

TimestampServerUrl​

Get the Timestamp Server Url from the certificate loaded.

public string TimestampServerUrl { get; }
Public Property TimestampServerUrl As String

Property Value​

String

Methods​

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

See Also​

ceTe.DynamicPDF