Opens a dialog box that allows a user to choose a list of recipients. Returns an array of generic Group objects that can be used when encrypting documents or data using either encryptForRecipients or addRecipientListCryptFilter methods of the Doc.
Note:Can be executed only during a console, menu, or application initialization event. See Privileged versus non-privileged context for details.
oOptions |
A DisplayOptions object containing the parameters for the display options. |
An array of Group objects.
See the Doc encryptForRecipients method for a description of the Group object.
The DisplayOptions object contains the following properties.
Property |
Description |
---|---|
bAllowPermGroups |
Controls whether permissions can be set for entries in the recipient list. Default value is true. |
bPlaintextMetadata |
If this property is specified, a check box is displayed to allow a user to select whether metadata is plaintext or encrypted. Its default value is the value of this property (true or false). If this property is not specified, the check box is not shown. |
cTitle |
The title to be displayed in the dialog box. The default is “Choose Recipients”. |
cNote |
A note to be displayed in the dialog box. The default is not to show any note. |
bAllowImportFromFile |
Specifies whether the option is displayed that allows a user to import recipients from a file. The default value is true. |
bRequireEncryptionCert |
If true, recipients will be required to include an encryption certificate. The default value is true. |
bRequireEmail |
If true, recipients will be required to include an email address. The default value is false. |
bUserCert |
If true, the user will be prompted to provide his or her own certificate so that he or she can be included in the list of recipients. Setting this flag to true results in a prompt but does not require that the user provide a certificate. |
Retrieve groups with permissions
var oOptions = {
bAllowPermGroups: true,
bPlaintextMetadata: false,
cTitle: "Encrypt and Email",
cNote: "Select recipients",
bAllowImportFromFile: false,
bRequireEncryptionCert: true,
bRequireEmail: true
};
var groupArray = security.chooseRecipientsDialog( oOptions );
console.println("Full name = " + groupArray[0].userEntities[0].fullName);
Get a list of recipients for which to encrypt data and email the document.
var oOptions = { bAllowPermGroups: false,
cNote: "Select the list of recipients. "
+ "Each person must have both an email address and a certificate.",
bRequireEmail: true,
bUserCert: true
};
var oGroups = security.chooseRecipientsDialog( oOptions );
// Display the list of recipients in an alert
// Build an email "to" mailList
var numCerts = oGroups[0].userEntities.length;
var cMsg = "The document will be encrypted for the following:\n";
var mailList = new Array;
for( var g=0; g<numCerts; ++g )
{
var ue = oGroups[0].userEntities[g];
var oCert = ue.defaultEncryptCert;
if( oCert == null )
oCert = ue.certificates[0];
cMsg += oCert.subjectCN + ", " + ue.email + "\n";
var oRDN = oCert.subjectDN;
if( ue.email )
{
mailList[g] = ue.email;
}
else
if ( oRDN.e )
{
mailList[g] = oRDN.e;
}
}
var result = app.alert( cMsg );
List all the entries in an array of groups.
var groups = security.chooseRecipientsDialog( oOptions );
for( g in groups ) {
console.println( "Group No. " + g );
// Permissions
var perms = groups[g].permissions;
console.println( "Permissions:" );
for(p in perms) console.println( p + " = " + eval("perms." +p));
// User Entities
for( u in groups[i].userEntities ) {
var user = groups[g].userEntities[u];
console.println( "User No. " + u );
for(i in user) console.println( i + " = " + eval("user." +i));
}
}
Displays a dialog box to allow a user to choose from a list of security policies, filtered according to the options.
Note:Can be executed only during a batch, console, or application initialization event. See Privileged versus non-privileged context for details. This method will display UI.
oOptions |
(optional) A SecurityPolicyOptions object containing the parameters used for filtering the list of security policies returned. If not specified, all policies found are displayed. |
Returns a single SecurityPolicy object or null if the user cancelled the selection.
Choose a policy and display the name.
var options = { cHandler: security.APSHandler };
var policy = security.chooseSecurityPolicy( options );
console.println("The policy chosen was: " + policy.name);
security.APSHandler is one of the security constants.
6.0 |
|
Exports a Certificate object to a local disk as a raw certificate file.
Note:Data being written must be data for a valid certificate; arbitrary data types cannot be written. This method will not overwrite an existing file.
See also security.importFromFile.
oObject |
The Certificate object that is to be exported to disk. |
cDIPath |
The device-independent save path. Note:The parameter cDIPath must be a safe path (see Safe path) and must end with the extension .cer. |
The path of the file that was written, if successful.
var outPath = security.exportToFile(oCert, "/c/outCert.cer");
Obtains a SecurityHandler object. The caller can create as many new engines as desired and each call to getHandler creates a new engine. However, there is only one UI engine.
Note:This method is available from batch, console, and app initialization events. See Privileged versus non-privileged context for details.
Backward Compatibility: Because Adobe.PPKMS is no longer available as a separate handler starting with
cName |
The language-independent name of the security handler, as returned by the handlers property. ( |
bUIEngine |
(optional) If true, the method returns the existing security handler instance that is associated with the |
The SecurityHandler object specified by cName. If the handler is not present, returns a null object.
Select the Adobe.PPKLite SecurityHandler.
// Validate signatures on open
security.validateSignaturesOnOpen = true;
// List all available signature handlers
var a = security.handlers;
for (var i = 0; i < a.length; i++)
console.println("a["+i+"] = "+a[i]);
// Use "Adobe.PPKLite" handler engine for the UI
var ppklite = security.getHandler(
security.PPKLiteHandler, true);
// Log in
ppklite.login("dps017", "/C/profiles/DPSmith.pfx");
See also the example following signatureSign for a continuation of this example.
Returns the list of security policies currently available, filtered according to the options specified. The master list of security policies will be updated prior to filtering. The default SecurityHandler objects are used to retrieve the latest policies. If no policies are available or none meet the filtering restrictions, null will be returned.
Note:You may be able to retrieve more policies by calling login on the default SecurityHandler objects before calling this function.
Can be executed only during a console or application initialization event. Not available in
bUI |
(optional) A flag controlling whether UI can be displayed. Default value is false. |
oOptions |
(optional) A SecurityPolicyOptions object containing the parameters used for filtering the list of security policies returned. If not specified, all policies found are returned. |
An array of SecurityPolicyOptions objects or null.
The SecurityPolicyOptions object has the following properties:
Property |
Description |
---|---|
bFavorites |
If not passed, policies are not filtered based on whether a policy is a Favorite. If true, only policies that are Favorites are returned. If false, only policies that are not Favorites are returned. |
cHandler |
If not passed, policies are not filtered based on security filter. If defined, only policies that match the specified security filter are returned. The valid values are defined in security Constants (see the HandlerName object). Only a single value can be passed. |
cTarget |
If not defined, policies are not filtered based on the target. If defined, only policies that match the specified target are returned. The valid values are defined in the EncryptTarget object of security constants. Only a single value can be passed. |
Retrieve the list of favorite PPKLite policies and display the names. This example uses security.PPKLiteHandler (see security constants).
var options = { bFavorites:true, cHandler:security.PPKLiteHandler };
var policyArray = security.getSecurityPolicies( { oOptions: options } );
for( var i = 0; i < policyArray.length; i++)
console.println( policyArray[i].name );
Force the login, retrieve the list of APS policies, and display the names. This example uses security.APSHandler (see security constants).
var aps = security.getHandler( security.APSHandler, true );
aps.login();
var options = { cHandler: security.APSHandler };
var policyArray = security.getSecurityPolicies({
bUI: true,
oOptions: options });
for(var i = 0; i < policyArray.length; i++)
console.println( policyArray[i].name );
Reads a raw data file and returns the data as an object with a type specified by cType. The file being imported must be a valid certificate. See also security.exportToFile
cType |
The type of object to be returned by this method. The only supported type is “Certificate”. |
cDIPath |
(optional) When bUI is false, this parameter is required and specifies the device-independent path to the file to be opened. If bUI is true, this is the seed path used in the open dialog box. |
bUI |
(optional) true if the user should be prompted to select the file that is to be imported. The default is false. |
cMsg |
(optional) If bUI is true, the title to use in the open dialog box. If cMsg is not specified, the default title is used. |
A Certificate object.
var oMyCert = security.importFromFile("Certificate", "/c/myCert.cer");
Allows limited functionality similar to Preferences > Security panel > Security Settings > Import, but it imports settings from an embedded file. This allows you to import digital IDs from an attached acrobat security settings file triggered by a button click from the containing document. Only digital IDs can be imported using this method, and other security settings, including trust settings, cannot be modified using this method. This method can only be triggered from a console, batch, or field mouse up event.
To create a file that can be embedded for this script, export the settings using Preferences > Security panel > Security Settings > Export. In the example below, if the script is attached to a button click event and the document represented by this is correctly formed, when the button is clicked it will bring up a simple import dialog for digital IDs.
Note:Security settings files must be certified in order to be considered valid.
oDocObj |
The object that represents the document, usually denoted by this in the context of running a script. |
cFilename |
The file name of the embedded file in oDocObj that contains a security settings file. A practical limit on the length of the file name is enforced. If the name is too long the import will fail. |
bSimplifiedUI |
true if a simplified user interface is to be used (if possible), false otherwise. For digital IDs, a simplified user interface can be displayed if only a single ID is imported. If there is more than one ID or bSimplifiedUI is false, then a list of IDs is shown instead. |
The number of digital IDs installed, or -1 if cancelled.
security.importSettings(this, "ids.acrobatsecuritysettings", true);