cete.dynamicpdf.certificate
Certificate
- Namespace: ceTe.DynamicPDF
- Assemblies: DynamicPDF.NETFramework40.dll, DynamicPDF.NETStandard20.dll
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 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
- certificateData: Byte[]
Byte array containing the digital certificate with private key.
- password: String
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
- storeName: StoreName
Value of type StoreName
- storeLocation: StoreLocation
Value of type StoreLocation
- certificateSubject: String
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
- certificateSubject: String
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
- storeName: String
Store name where the certificate resides.
- storeLocation: StoreLocation
Value of type StoreLocation
- certificateSubject: String
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
- certificatePath: String
Physical file path to a digital certificate with private key.
- password: String
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
- certificate: X509Certificate2
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
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
Subject
Gets the complete subject string from the certificate loaded.
public string Subject { get; }
Public Property Subject As String
Property Value
SubjectName
Gets the subject name of the certificate loaded.
public string SubjectName { get; }
Public Property SubjectName As String
Property Value
TimestampServerUrl
Get the Timestamp Server Url from the certificate loaded.
public string TimestampServerUrl { get; }
Public Property TimestampServerUrl As String
Property Value
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
- obj: Object
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 .