|
Use this method to sign a signature field.
In order to sign a signature, you need to use your private key.
To authorize the use of this key, you need to provide your
password.
If you are using a X509Certificate2 certificate with a password
protected private key you need to instantiate the X509Certificate2
instance with the optional parameter
X509KeyStorageFlags.Exportable. This will give the Sign method
access to the private key. If the private key is not accessible
this method will throw an exception. Where the private key is on a
Hardware Security Module you should use the SecureString overload
as shown in the example under CompliancePades.
If private key is held in an PFX/PKCS #12 (.pfx or .p12) file,
you need to provide a path to this file and a password to allow use
of the private key.
Different digest algorithms may be used to create signatures.
The default is SHA256 but you may also use SHA256, SHA384, SHA512.
SHA1 can be specified but is deprecated in PDF 2.0 so it is not
advised.
Time-stamped signatures can be produced by using the service of
a Time Stamping Authority (TSA). See TimestampServiceUrl.
Also see Compliance for TSA
requirements under different compliance levels.
If you are signing multiple signature fields in the same PDF
document, you should call Commit manually
after each signing operation.
The overloads taking a dataType parameter allow you to use a
custom delegate to sign the document. The certificate is required
here as a template into which the digest can be inserted.
If the file is not available, if the file is invalid or if the
password is incorrect, then this function will throw an
exception.
|