Security
Digital IDs and Certification Methods
12
An example is given below:
// Obtain the security handler:
var ppklite = security.getHandler("Adobe.PPKLite");
// Create the relative distinguished name:
var newRDN = {
cn: "newUser",
c: "US"
};
// Create the certificate policy information:
var newCPS = {
oid: "1.2.3.4.5",
url: "http://newca.com/newCPS.html",
notice: "This is a self-generated certificate"
};
// Create the new user’s certificate:
security.newUser({
cPassword: "newUserPassword",
cDIPath: "/C/newUser.pfx",
oRDN: newRDN,
oCPS: newCPS,
bUI: false
});
The
securityHandler
object has a
DigitalIDs
property that contains the
certificates associated with the currently selected digital IDs for the security handler. The
DigitalIDs
property is a generic object containing the following properties:
●
●
●
●
oEndUserSignCert
: the certificate used when signing
oEndUserCryptCert
: the certificate used when encrypting
certs
: an array of certificates corresponding to all the digital IDs
stores
: an array of strings (one for every
certificate
object) indicating where the
digital IDs are stored
You may use the
security
object’s
exportToFile
method to save a certificate file to
disk. In the following example, the signing certificate is written to disk:
// Obtain the security handler:
var sh = security.getHandler("Adobe.PPKMS");
// Obtain the certificates:
var ids = sh.DigitalIDs;
// Write the signing certificate to disk:
security.exportToFile(ids.oEndUserSignCert, "/C/mySignCert.cer");
Acrobat JavaScript Scripting Guide
221