12
Security
Digital IDs and Certification Methods
Using Digital IDs (Default Certificate Security)
As you learned earlier, you may obtain signature information from a signature field by
invoking its
signatureInfo
method. In addition to this, you may also use an existing
certificate to create a digital ID. To do this, obtain the certificate from an existing, signed
field and create the relative distinguished name using the information it contains, as shown
in the following example:
// Obtain the security handler:
var ppklite = security.getHandler("Adobe.PPKLite");
// Obtain the signature field:
var f = this.getField("existingSignature");
// Validate the signature:
f.signatureValidate();
// Obtain the signature information:
var sigInfo = f.signatureInfo();
// Obtain the certificates and distinguished name information
var certs = sigInfo.certificates;
var rdn = certs[0].subjectDN;
// Now create the digital signature:
ppklite.newUser({
cPassword: "newUserPassword",
cDIPath: "/C/newUser.pfx",
oRDN: rdn,
});
222
Acrobat JavaScript Scripting Guide