12
Security
Digitally Signing PDF Documents
The Security Handler Object
To obtain a security handler (the
oSig
parameter), invoke the
security
object’s
getHandler
method, which creates a new security handler engine, and accepts the
following parameters:
●
●
cName
: the name of the security handler (contained in the
security
object’s
handlers
property)
bUIEngine
: the existing engine associated with the Acrobat user interface
The following code illustrates how to set up signature validation whenever the document is
opened, lists all available security handlers, and selects the
Adobe.PPKLite
engine
associated with the Acrobat user interface:
// Validate signatures when the document is opened:
security.validateSignaturesOnOpen = true;
// List all the available signature handlers
for (var i=0; i<security.handlers.length; i++)
console.println(security.handlers[i]);
// Select the Adobe.PPKLite engine with Acrobat user interface:
var ppklite = security.getHandler("Adobe.PPKLite", true);
After obtaining the security handler, invoke the
securityHandler
object’s
login
method, which makes it possible to access and select your digital ID, as shown in the
following code:
var oParams = {
password: "myPassword",
cDIPath: "/C/signatures/myName.pfx" // digital signature profile
};
ppklite.login(oParams);
The SignatureInfo Object
To create the
oInfo
parameter for the signature field’s
signatureSign
method, create
a generic object containing the properties as described above in
Table 12.1.
An example of
its usage when creating an author signature is given below:
var myInfo = {
password: "myPassword",
location: "San Jose, CA",
reason: "I am approving this document",
contactInfo: "userName@adobe.com",
appearance: "Fancy",
mdp: "allowNone" // an mdp value is needed for author signatures
};
206
Acrobat JavaScript Scripting Guide