OfficeDigitalSignature Class
Represents a digital signature from a Word document.
Inheritance
System.Object
OfficeDigitalSignature
Namespace: Syncfusion.Office
Assembly: Syncfusion.Compression.Base.dll
Syntax
public class OfficeDigitalSignature : Object
Constructors
OfficeDigitalSignature()
Initializes a new instance of the OfficeDigitalSignature class.
Declaration
public OfficeDigitalSignature()
Examples
//Create a new Word document
WordDocument document = new WordDocument();
//Add a section into the word document
IWSection section = document.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
// Add a text into the paragraph
paragraph.AppendText("Hello World");
// Create a new digital signature for the document
OfficeDigitalSignature signature = new OfficeDigitalSignature();
//Load the certificate from a file
OfficeDigitalSignatureCertificate certificate = new OfficeDigitalSignatureCertificate(@"C:\Data\certificate.pfx", "password");
Create a new signature settings for the digital signature
SignatureSettings settings = new SignatureSettings();
// Set the comments for the digital signature
settings.Comments = "Signed by Syncfusion";
document.AddDigitalSignature(certificate, settings);
document.Save(@"C:\Data\SampleDocument.docx");
document.Close();
Properties
ApplicationVersion
Gets the application version.
Declaration
public string ApplicationVersion { get; }
Property Value
| Type |
|---|
| System.String |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the application version
string appVersion = signature.ApplicationVersion;
Console.WriteLine(appVersion);
document.Close();
Certificate
Gets the signer certificate information.
Declaration
public OfficeDigitalSignatureCertificate Certificate { get; }
Property Value
| Type |
|---|
| OfficeDigitalSignatureCertificate |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the signer certificate information
OfficeDigitalSignatureCertificate cert = signature.Certificate;
Console.WriteLine(cert.Subject);
document.Close();
ColorDepth
Gets the color depth.
Declaration
public int ColorDepth { get; }
Property Value
| Type |
|---|
| System.Int32 |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the color depth
int colorDepth = signature.ColorDepth;
Console.WriteLine(colorDepth);
document.Close();
Comments
Gets the signing comments.
Declaration
public string Comments { get; }
Property Value
| Type |
|---|
| System.String |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the signing comments
string comments = signature.Comments;
Console.WriteLine(comments);
document.Close();
HorizontalResolution
Gets the horizontal resolution.
Declaration
public float HorizontalResolution { get; }
Property Value
| Type |
|---|
| System.Single |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the horizontal resolution
float dpiX = signature.HorizontalResolution;
Console.WriteLine(dpiX);
document.Close();
IsValid
Gets a value indicating whether the signature is valid. Delegates to Syncfusion.Office.OfficeDigitalSignatureValidator to perform the full XMLDSIG pipeline: digest integrity, signature authenticity, and certificate trust checks.
Declaration
public bool IsValid { get; }
Property Value
| Type |
|---|
| System.Boolean |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Checks whether the signature is valid
bool isValid = signature.IsValid;
Console.WriteLine(isValid);
document.Close();
OfficeVersion
Gets the Office version.
Declaration
public string OfficeVersion { get; }
Property Value
| Type |
|---|
| System.String |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the Office version
string officeVersion = signature.OfficeVersion;
Console.WriteLine(officeVersion);
document.Close();
SignatureValue
Gets the signature value.
Declaration
public byte[] SignatureValue { get; }
Property Value
| Type |
|---|
| System.Byte[] |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the signature value
byte[] signatureBytes = signature.SignatureValue;
Console.WriteLine(signatureBytes.Length);
document.Close();
SigningTime
Gets the signing timestamp.
Declaration
public DateTime SigningTime { get; }
Property Value
| Type |
|---|
| System.DateTime |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the signing timestamp
DateTime when = signature.SigningTime;
Console.WriteLine(when);
document.Close();
VerticalResolution
Gets the vertical resolution.
Declaration
public float VerticalResolution { get; }
Property Value
| Type |
|---|
| System.Single |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the vertical resolution
float dpiY = signature.VerticalResolution;
Console.WriteLine(dpiY);
document.Close();
WindowsVersion
Gets the Windows version.
Declaration
public string WindowsVersion { get; }
Property Value
| Type |
|---|
| System.String |
Examples
//Open an existing signed Word document from a file
WordDocument document = new WordDocument(@"C:\Data\SignedDocument.docx");
//Get the first digital signature in the document
OfficeDigitalSignature signature = document.Signatures[0];
//Gets the Windows version
string windowsVersion = signature.WindowsVersion;
Console.WriteLine(windowsVersion);
document.Close();