Skip to content

PDFComputedDigitalSignature

Namespace: O2S.Components.PDF4NET.DigitalSignatures

Defines a PDF digital signature loaded from a signed PDF file.

public class PDFComputedDigitalSignature : PDFBaseDigitalSignature

Inheritance ObjectPDFBaseDigitalSignaturePDFComputedDigitalSignature

Properties

Certificate

Gets the sign certificate.

public X509Certificate2 Certificate { get; }

Property Value

X509Certificate2
A that represents the certificate used to sign the document.


ContactInfo

Gets or sets the contact information.

public string ContactInfo { get; set; }

Property Value

String
Information provided by the signer to enable a recipient to contact the signer to verify the signature.

Remarks

This property should not be set for PDFDocumentTimeStamp signatures.


CosDictionary

Gets the signature dictionary.

public PDFCosDictionary CosDictionary { get; }

Property Value

PDFCosDictionary
The COS signature object for setting custom values for the signature.


Location

Gets or sets the location.

public string Location { get; set; }

Property Value

String
The CPU host name or physical location of the signing.

Remarks

This property should not be set for PDFDocumentTimeStamp signatures.


Name

Gets or sets the name.

public string Name { get; set; }

Property Value

String
The name of the person or authority signing the document.

Remarks

This property should not be set for PDFDocumentTimeStamp signatures.


Reason

Gets or sets the sign reason.

public string Reason { get; set; }

Property Value

String
The reason for the signing.

Remarks

This property should not be set for PDFDocumentTimeStamp signatures.


SignatureDate

Gets or sets the sign date.

public DateTime SignatureDate { get; set; }

Property Value

DateTime
The date and time when the signature was applied.


SignatureDigestAlgorithm

Gets the signature digest algorithm.

public PDFDigitalSignatureDigestAlgorithm SignatureDigestAlgorithm { get; }

Property Value

PDFDigitalSignatureDigestAlgorithm
A PDFDigitalSignatureDigestAlgorithm enum member specifying the digest algorithm used in the computation of the digital signature.


Methods

DecodeSignature()

Decodes the signature into a hierarchy of ASN.1 objects.

public Asn1Object[] DecodeSignature()

Returns

Asn1Object[]
The hierarchy of ASN.1 objects that compose this signature.


GetRawSignatureData()

Gets the raw signature data exactly as it appears in the PDF file.

public string GetRawSignatureData()

Returns

String
The exact string COS object that represents the signature data including the string terminators.


GetSignatureData()

Gets the raw signature data as it appears in the PDF file.

public Byte[] GetSignatureData()

Returns

Byte[]
The DER encoded signature data as byte array. If the signature string contains invalid HEX characters then the corresponding byte is set to 0.


GetSignedBytes(Stream)

Gets the bytes used for creating this signature.

public Byte[] GetSignedBytes(Stream signedFile)

Parameters

signedFile Stream
The input PDF file that was used to create the document from which this signature object was retrieved.

Returns

Byte[]
The array of bytes that were used as input for computing the document digest required for generating this signature.


SaveSignedCopy(Stream, Stream)

Saves a copy of the PDF file that is covered by this signature.

public void SaveSignedCopy(Stream signedFile, Stream output)

Parameters

signedFile Stream
The input PDF file that was used to create the document from which this signature object was retrieved.

output Stream
Destination stream where to save the signed copy.

Remarks

The stream used to create the PDFFixedDocument object from which this signature was retrieved is required as input because the document does not keep a reference to the stream it was created from. Because the digital signatures are computed on the physical layout of the PDF file, it is impossible to recreate this layout from a loaded PDFFixedDocument object.