DynaPDF Manual - Page 212

Previous Page 211   Index   Next Page 213

Function Reference
Page 212 of 839
Remarks:
Further information about digital signatures can be found under Digital Signatures. To encrypt and
sign a PDF file use the function CloseAndSingFileEx(). The appearance of a signature field can be
user defined. See CreateSigFieldAP() for further information.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
CloseAndSignFileEx
Syntax:
SI32 pdfCloseAndSignFileEx(
const PPDF* IPDF,
// Instance pointer
const char* OpenPwd,
// Optional Open password
const char* OwnerPwd,
// Optional Owner password
TKeyLen KeyLen,
// Key length (40 or 128 bit)
TRestrictions Restrict, // Restrictions
const char* CertFile,
// File path to a PKCS#12 certificate file
const char* Password,
// Password to decrypt the cert's private key
const char* Reason,
// Optional reason string
const char* Location)
// Optional signers location string
This function finishes the PDF file, encrypts it, digitally signs it, and frees all used resources if the
file was not created in memory. The first five parameters have the same meaning as of the function
CloseFileEx(). The remaining parameters are identical to CloseAndSignFile(). This function simply
combines both functions because a PDF file must be encrypted and digitally signed in one pass. The
encryption parameters are described in detail under CloseFileEx().
The parameter CertFile must be a valid path to a PKCS#12 certificate file. DynaPDF supports
certificate files with 1024 bits encrypted private keys only. The parameter Password holds the
password to decrypt the private key. The parameters Reason and Location are both optional. These
strings are printed into the signature field if set.
Digital signatures are stored in a signature field which is a special type of Interactive Form field. If
no signature field exist when the function is called then DynaPDF creates an invisible signature
field. Hidden signature fields appear in the signatures tab of Adobe's Acrobat.
If one or more signature fields exist when the function is called then the first signature field is used
for signing. Signature fields can be created with the function CreateSigField() but it is also possible
to import empty signature fields from an external PDF file.
Importing signed PDF files
Signed PDF files can only be changed, without invalidating an existing signature, when changes are
stored with an incremental update. An incremental update is a special way to modify a PDF file;
 

Previous topic: Importing signed PDF files, Possible function errors

Next topic: Possible function errors, CloseAndSignFileExt