Skip to main content

Certificate

Version: 6.0

cete.dynamicpdf.certificate

Certificate​

Represents a digital certificate.

public class Certificate
Public Class Certificate

Inheritance: Object → Certificate

Licensing​

This class is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:

  • DynamicPDF Generator for .NET Enterprise Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF ReportWriter for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

Examples​

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

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

Module Module1

Sub Main()

' Create a PDF Document
Dim MyDocument As Document = New Document

' Create a PDF Page
Dim MyPage As Page = New Page

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

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

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

' Create a Certificate
Dim MyCertificate As Certificate = New Certificate("C:\PersonalCertificate.pfx", "CertificatePassword")

' Certify the document refering the sign field
MyDocument.Certify("SigField", MyCertificate, CertifyingPermission.NoChangesAllowed)

' Save the document
MyDocument.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 refering 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.

Constructors​

Certificate(Byte[], String)​

Intializes 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)​

Intializes 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 protion 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)​

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

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

Parameters​

A protion 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)​

Intializes 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 protion 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)​

Intializes 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)​

Intializes 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​

Issuer​

Gets the complete issuer string from the certificate loaded.

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

Property Value​

String

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