Table of Contents

Method Sign

Namespace
BitMiracle.Docotic.Pdf
Assembly
BitMiracle.Docotic.Pdf.dll

Sign(byte[])

Signs the specified message.

byte[] Sign(byte[] message)

Parameters

message byte[]

The message to sign. The library generates the message as the digest of the PDF document bytes using the DigestAlgorithm algorithm.

Returns

byte[]

The digital signature of the message, created using the specified SignatureAlgorithm. The returned value must be the raw signature bytes, not DER encoded.

Remarks

This method should only generate the cryptographic signature and must not return an entire PKCS#7 object. The library handles all PKCS#7 formatting and uses this method to write the encryptedDigest field in the SignerInfo object.

The library calls this method twice per each signature:

  1. The first call is to calculate the space required for the signature. The library only uses the length of the resulting bytes. For the first call, this method can return the same bytes for the same signing parameters (DigestAlgorithm and SignatureAlgorithm). It allows you to optimize performance/costs for cloud-based or HSM signing operations.
  2. The second call is to actually sign the document. This method must return the real bytes of the signature.