#define PDCryptFilterStringProc
CosCryptStringProc
kGCHTTipText = 1 | |
kGCHTMiniText | |
kGCHTLargeText |
typedef
struct
_t_PDCryptBatchHandler
*
PDCryptBatchHandler
;
typedef
struct
_t_PDCryptFilterHandler
*
PDCryptFilterHandler
;
typedef
struct
_t_PDCryptHandler
*
PDCryptHandler
;
Replaces PDCryptAuthorizeProc. PDPerms are obsolete, but Acrobat still supports old security handlers.
It is called whenever Acrobat needs to get authorization data and/or check permissions for operations.
PDPermReqStatus
PDCryptAuthorizeExProc(
PDDoc
pdDoc
,
PDPermReqObj
reqObj
,
PDPermReqOpr
reqOpr
,
void
*
authData
);
pdDoc | The document for which the request is made.
|
reqObj | The object type that is the focus of the request: it is one of the PDPermReqObj values.
|
reqOpr | The operation type that is the focus of the request: it is one of the PDPermReqOpr values.
|
authData | Authorization data. Its format is security handler-specific.
|
A callback for PDCryptHandler. It is called by PDDocAuthorize() when a user tries to set security for an encrypted document and by a PDAuthProc() when a user tries to open a file.
It must decide, based on the contents of the authorization data structure, whether the user is permitted to open the file, and what permissions the user has for this file. The authorization data structure is available for making this decision. Alternate implementations may not require authorization data and may, for example, make authorization decisions based on data contained in the security data structure (use PDCryptNewSecurityDataProc()).
This callback must not obtain the authorization data (for example, by displaying a user interface into which a user can type a password). Obtaining authorization data is handled by the security handler's PDCryptGetAuthDataProc(), which must be called before this callback. Instead, PDCryptAuthorizeProc() must work with whatever authorization data is passed to it.
It is legitimate for this callback to be called with NULL
authorization data; the Acrobat viewer's built-in authProc
does this in order to support authorization methods that do not require authorization data.
When this callback is invoked to determine whether a user is permitted to open a file, permWanted
is set to pdPermOpen
. In this case, the file's contents are not yet decrypted (since this callback is being asked to permit decryption), and some calls must be avoided. For example, a call that causes a page to be parsed results in an error, since the encrypted contents are parsed. In general, it is safe to obtain information about the presence or absence of things, or the number of things, and to examine any part of a document at the Cos level.
PDPerms
PDCryptAuthorizeProc(
PDDoc
pdDoc
,
void
*
authData
,
PDPerms
permWanted
);
pdDoc | The document for which authorized permissions are being requested.
|
authData | Authorization data. Its format is security handler-specific; each handler can select its own authorization data format.
|
permWanted | The permissions being requested. It is either
pdPermOpen (if the file is being opened) or pdPermSecure (if a request is being made to change the document's security settings). |
authData
. For opening, the permissions returned usually should be pdPermOpen
and some or all of pdPermPrint
, pdPermEdit
, and pdPermCopy
. For setting security, permissions returned should be pdPermAll
. However, if authorization fails, 0
should be returned. NULL
authData
for the case without a user password. It is called again with authorization data provided for the security handler that matches the one used in the PDF file. Note: This function is called a batch operation and therefore should not display any user interface. During a batch operation, a file will first be opened with the pdPermSecure
bit set. It will then be opened with the pdPermOpen
bit set.
PDPermReqStatus
PDCryptBatchAuthorizeProc(
PDDoc
pdDoc
,
PDPermReqObj
reqObj
,
PDPermReqOpr
reqOpr
,
void
*
authData
);
pdDoc | IN/OUT The document being opened.
|
reqObj | IN/OUT The object type that is the focus of the request: it is one of the PDPermReqObj values.
|
reqOpr | IN/OUT The operation type that is the focus of the request: it is one of the PDPermReqOpr values.
|
authData | IN/OUT Authorization data. Its format is security handler-specific.
|
authData
acquired via BatchGetAuthData() or BatchNewAuthData(). If no BatchFreeAuthData() function is provided, a default one will be used which calls ASfree() on the authData
if it is non- NULL
. void
PDCryptBatchFreeAuthDataProc(
void
*
authData
);
authData | IN/OUT Authorization data. Its format is security handler-specific.
|
NewAuthData
function. It creates and returns a void
*
which is the authorization data for the batch security handler. This data should be used to batch both open files and secure files. Therefore, make sure to provide password information for both the pdPermOpen
and pdPermSecure
cases. This data will be passed to the PDCryptBatchAuthorizeProc() callback and eventually to PDCryptBatchFreeAuthDataProc() to free the data. This authorization data is collected before any files are opened in the batch sequence. It is permitted to display a user interface at this point since the batch operation has not started yet. The data applies to all files, and therefore could represent one or more passwords which can be enumerated in the BatchAuthorize
function which receives the batch authorization data. void
*
PDCryptBatchNewAuthDataProc(
void
);
paramDesc
ASCab using ASText objects starting with key "
1"
. void
PDCryptBatchParamDescProc(
const
ASCab
settings
,
ASCab
paramDesc
);
settings | IN/OUT Batch settings.
|
paramDesc | IN/OUT Description information.
|
key="
1",
value="Title:
API
Reference"
(ASText object) void
PDCryptBatchPostSequenceProc(
ASCab
settings
);
settings | IN/OUT Batch settings.
|
false
, the viewer will assume that the command cannot be executed and will cancel the sequence. ASBool
PDCryptBatchPreSequenceProc(
ASCab
settings
);
settings | IN/OUT Batch settings.
|
ASBool
PDCryptBatchShowDialogProc(
ASCab
settings
);
settings | IN/OUT An object of type ASCab.
|
true
indicates success. Note: This function is called a batch operation and therefore should not display any user interface.
ASBool
PDCryptBatchUpdateSecurityDataProc(
PDDoc
pdDoc
,
ASCab
settings
,
ASAtom
*
cryptHandler
,
void
*
*
secDataP
);
pdDoc | The document whose data is updated.
|
settings | An object of type ASCab.
|
cryptHandler | An object of type ASAtom.
|
secDataP | A pointer to the document's security data.
|
true
unless there is a problem with the batch data for this security handler. ASBool
PDCryptCanParseEncryptDictProc(
PDDoc
pdDoc
,
CosObj
encryptDict
);
pdDoc | The document being opened.
|
encryptDict | The encryption dictionary.
|
true
if the handler supports the format of encryptDict
. Called when the security handler should bring up a document (security) information dialog box with the current settings. It also should return true
when the user wants to change the settings.
If this callback is not supplied, the default information dialog is displayed with PDPerms bits information (an Acrobat 4.x-equivalent dialog).
ASBool
PDCryptDisplaySecurityDataProc(
PDDoc
pdDoc
,
ASAtom
cryptHandler
);
pdDoc | IN/OUT The document whose information is displayed.
|
cryptHandler | IN/OUT The registered name of the handler.
|
ASBool
PDCryptEncryptDocMetadata(
PDDoc
pdDoc
);
pdDoc | IN The document being encrypted.
|
true
if document metadata should be encrypted. A callback for PDCryptHandler. It is called when an encrypted document is saved. It fills the document's Encryption dictionary with whatever information the security handler wants to store in the document.
Normally this callback is called after PDCryptUpdateSecurityDataProc(). The security data structure can be obtained with a call to PDDocGetNewSecurityData(), and encryptDict
is filled based on this data.
The sequencing of events that the viewer performs during creation of the encryptDict is as follows:
encryptDict
.2
or greater.void
PDCryptFillEncryptDictProc(
PDDoc
pdDoc
,
CosObj
encryptDict
);
pdDoc | IN/OUT The document to save.
|
encryptDict | IN/OUT A dictionary Cos object to fill with whatever information the security handler wants to store in the PDF file. Unlike all other strings and streams, direct object elements of the
encryptDict are not encrypted automatically. If you want them encrypted, you must encrypt them before inserting them into the dictionary. |
ASBool
PDCryptFilterAuthorizeProc(
CosDoc
dP
,
ASAtom
filterName
,
CosObj
encryptDict
,
ASBool
bEncrypt
,
ASBool
bUIAllowed
);
dP | The document for which to perform authorization.
|
filterName | The name of the security filter.
|
encryptDict | The encryption dictionary to use.
|
bEncrypt | |
bUIAllowed |
ASInt32
PDCryptFilterGetDataProc(
CosDoc
dP
,
ASAtom
filterName
,
char
*
*
key
,
ASBool
bNewKey
,
ASBool
bUIAllowed
);
dP | The document whose data is retrieved.
|
filterName | The name of the security filter.
|
key | (Filled by the method) A pointer to the encryption/decryption key.
|
bNewKey | |
bUIAllowed |
(Optional) A callback for PDCryptFilterHandler. Callbacks that conform to this prototype are called to encrypt or decrypt streams from a document.
The first call to a procedure of this type must fill out an ASCryptStmRec structure with pointers to callback routines for various types of stream access; see ASCryptStmProcs().
void
PDCryptFilterStreamProc(
CosDoc
dP
,
ASAtom
filterName
,
ASCryptStm
stm
,
ASBool
handOff
,
CosObj
params
,
ASInt32
stmLength
);
dP | The document containing the stream.
|
filterName | The name of the security filter in use.
|
stm | The security stream structure containing the stream itself, access information, and an ASCryptStmRec. This callback function is called upon opening the stream; the first call must initialize the stream.
|
handOff | |
params | A Cos object containing parameters for the operation, as specified for the filter.
|
stmLength | For a decryption operation, the requested number of bytes; for an encryption operation, the number of bytes in the stream contained in
stm . |
void
PDCryptFreeAuthDataProc(
PDDoc
pdDoc
,
void
*
authData
);
pdDoc | IN/OUT The document whose authorization data is freed.
|
authData | IN/OUT (Filled by the callback) A pointer to the document's authorization data.
|
void
PDCryptFreeCryptDataProc(
PDDoc
pdDoc
,
char
*
cryptData
);
pdDoc | IN/OUT The document whose encryption/decryption data is freed.
|
cryptData | IN/OUT (Filled by the callback) A pointer to the document's encryption/decryption data.
|
void
PDCryptFreeSecurityDataProc(
PDDoc
pdDoc
,
void
*
secData
);
pdDoc | IN/OUT The document whose security data is freed.
|
secData | IN/OUT (Filled by the callback) A pointer to the document's security data.
|
Replaces PDCryptGetAuthDataProc(). It is called whenever Acrobat needs to get authorization data and/or check permissions for operations.
PDPerms are obsolete. Acrobat provides permission controls, but Acrobat still supports old security handlers.
ASBool
PDCryptGetAuthDataExProc(
PDDoc
pdDoc
,
PDPermReqObj
reqObj
,
PDPermReqOpr
reqOpr
,
void
*
*
authDataP
);
pdDoc | The document for which the request is made.
|
reqObj | The object type that is the focus of the request: it is one of the PDPermReqObj values.
|
reqOpr | The operation type that is the focus of the request: it is one of the PDPermReqOpr values.
|
authDataP | A pointer to an authorization data structure. Its format is security handler-specific.
|
true
unless the operation should be cancelled (for example, if the user cancels a dialog), false
otherwise. A callback for PDCryptHandler. This callback is called from a PDAuthProc when a file is opened after PDCryptNewSecurityDataProc() is called.
The callback must determine the user's authorization properties for the document by obtaining authorization data, such as a user interface log in or password entry. It populates an authorization data structure with this data.
This callback may call the security handler's PDCryptNewAuthDataProc() to allocate the authorization data structure. The use of an authorization data structure is optional (an implementation may wish to contain authorization data within the security data structure). The authorization data structure is subsequently used by the security handler's PDCryptAuthorizeProc() to determine whether the user is authorized to open the file.
A security handler can specify the standard password dialog box by using AVCryptGetPassword(). In this case, authData
is a char
*
.
ASBool
PDCryptGetAuthDataProc(
PDDoc
pdDoc
,
PDPerms
permWanted
,
void
*
*
authDataP
);
pdDoc | The document to open.
|
permWanted | Either
pdPermOpen or pdPermSecure . Since this value is also passed to PDCryptAuthorizeProc(), it may not be necessary for this callback to use permWanted . |
authDataP | A pointer to the authorization data structure. Set it to
NULL if it is not used. |
true
unless the operation should be cancelled (for example, if the user cancels a dialog), false
otherwise. A callback for PDCryptHandler. This function should extract and return information about the document permissions to display for the user: whether the user can print, edit, copy text and graphics, edit notes and do form fill in and signing.
The permissions returned are logically AND-ed with the document permissions returned by any other permissions handlers, and displayed to the user. All crypt handlers should implement this call so that consolidated permissions can be displayed. To display your own crypt handler's permissions, implement PDCryptDisplaySecurityDataProc().
If this callback is absent, Acrobat assumes that all the operations on the document are allowed.
void
PDCryptGetDocPermsProc(
PDDoc
pdDoc
,
ASBool
perms
[
PDPermReqObjLast
]
[
PDPermReqOprLast
]
,
ASInt16
*
version
);
pdDoc | The document whose permissions are obtained.
|
perms | (Filled by the callback) An array of the document's permissions. For each combination of PDPermReqObj and PDPermReqOpr, the value is
true if the operation is allowed for the object, false if it is not. |
version | (Filled by the callback) A pointer to the version number of PDPermReqObj and PDPermReqOpr with which this crypt handler is compatible (specified by the constant PDPermReqVersion).
|
ASText
PDCryptGetInfoTextProc(
PDDoc
pdDoc
,
GCHTextType
textType
);
pdDoc | IN The document.
| ||||||||
textType | IN The text that should be used:
|
(Optional) A callback for PDCryptHandler. It is called by PDDocGetNewSecurityInfo(). It extracts the security information from the security data structure, and returns the security information.
This function is also used after a Save As... to reset the permissions according to the current document.
A default set of permissions is used if this callback is absent:
pdInfoCanPrint|pdInfoCanEdit|pdInfoCanCopy|pdInfoCanEditNotes
See PDPerms.
void
PDCryptGetSecurityInfoProc(
PDDoc
pdDoc
,
ASUns32
*
secInfo
);
pdDoc | The document whose security information is obtained.
|
secInfo | (Filled by the callback) The document's security information. The value must be an OR of the Security Info Flags. All unused bits in must be set to
1 . |
(Optional) A callback for PDCryptHandler. It creates a new empty authorization data structure. This structure is subsequently filled by PDCryptGetAuthDataProc(), then passed to PDCryptAuthorizeProc() and eventually to ASfree().
This callback is not called by the Acrobat viewer, but a security handler may use it if it wishes. The Acrobat viewer's standard security handler does not use this method.
void
*
PDCryptNewAuthDataProc(
PDDoc
pdDoc
);
pdDoc | The document for which a new authorization data structure is created.
|
A callback for PDCryptHandler. It sets up the key to be passed to initialize the RC4 cipher for encryption and decryption of a PDF file. It is called when an encrypted document is opened or saved.
The key is truncated when the length is greater than the viewer currently supports. Data is freed by PDCryptFreeCryptDataProc() if provided. Otherwise, ASfree() is used.
void
PDCryptNewCryptDataExProc(
PDDoc
pdDoc
,
char
*
*
cryptData
,
ASInt32
*
cryptDataLen
,
ASInt32
*
cryptVersion
);
pdDoc | IN/OUT The document for which the key is set.
|
cryptData | |
cryptDataLen | IN/OUT (Filled by the callback) The number of bytes in
cryptData . It cannot be greater than 5 bytes. |
cryptVersion | IN/OUT The Cos crypt version, which is the version of the algorithm that is used to encrypt and decrypt document data.
cryptVersion equal to 0 is treated as cryptVersion equal to 1 to maintain backward compatibility. |
void
PDCryptNewCryptDataProc(
PDDoc
pdDoc
,
char
*
*
cryptData
,
ASInt32
*
cryptDataLen
);
pdDoc | IN/OUT The document for which the key is set.
|
cryptData | |
cryptDataLen | IN/OUT (Filled by the callback) The number of bytes in cryptData. It cannot be greater than
5 bytes. |
Called when the application needs to open a rolled back portion of the original document. A rolled back document is the original portion of the document when it is digitally signed. This functionality is used for document modification detection.
A rolled back document still requires authorization data which should be identical to the original document's. However, the authDataP
structure is unique to each security handler; therefore, it cannot be duplicated by the application.
This callback is intended for opening a rolled back document silently by asking the security handler to provide authorization data for it. The security handler should be able to duplicate the security data associated with the original document and supply for the rolled back document. The callee is expected to authorize subsequent callbacks, including Crypt Filters.
If this callback is not provided, the security handler is asked for authorization data via a normal call such as PDCryptGetAuthDataExProc(). The side effect might include the security handler's prompting for a password for the rolled back document.
ASBool
PDCryptNewSecurityDataFromOriginalDocProc(
PDDoc
pdDoc
,
CosObj
encryptDict
,
PDDoc
alreadyOpenedDoc
,
CosObj
openedEncryptDict
,
void
*
*
authDataP
);
pdDoc | The document for which the request is made (a rolled back document).
|
encryptDict | An encryption dictionary for
pdDoc . It is here just in case the security handler might need it. |
alreadyOpenedDoc | The original PDDoc from which the rolled back document is extracted. It is provided so that the security handler can get security data out for the rolled back document.
|
openedEncryptDict | The encryption dictionary of the original PDDoc.
|
authDataP | Used to return security data for the rolled back document.
|
true
unless the security handler cannot provide authorization data for the requested document. (Optional) A callback for PDCryptHandler. It creates and populates a new structure that contains whatever security-related information the security handler requires (for example, permissions, whether the file has owner and/or user passwords, owner and/or user passwords, or other data used internally by the security handler). If encryptDict
is not NULL
, the structure should be populated based on the encryptDict
parameter's contents. This method is intended only to initialize the security data structure.
This callback is called under two circumstances:
If a security handler does not have this callback, the document's newSecurityData
field is set to NULL
.
If a file is to be saved, then PDCryptUpdateSecurityDataProc() is subsequently called to allow user interface modification of the contents.
Security data is freed using PDCryptFreeSecurityDataProc(). If PDCryptFreeSecurityDataProc() is not defined, ASfree() is used.
void
*
PDCryptNewSecurityDataProc(
PDDoc
pdDoc
,
CosObj
encryptDict
);
pdDoc | The document for which a new security data structure is created.
|
encryptDict | If
encryptDict is a dictionary, this callback must initialize the security data so that it corresponds to the dictionary. Otherwise, it must set up default values in the security data structure. |
void
*
PDCryptReservedProc(
void
);
void
*
PDCryptReservedProc2(
PDDoc
pdDoc
,
ASCab
settings
);
A callback for PDCryptHandler. It updates the security data structure that was created by PDCryptNewSecurityDataProc(). This structure can be obtained by calling PDDocGetNewSecurityData(). The security data structure of the previously saved file can be obtained with a call to PDDocGetSecurityData().
The security data structure should be updated to reflect the encryption parameters that will be used when saving the file (this information is usually obtained via dialogs). The encryption parameters are transferred to the Encrypt dictionary by a subsequent callback to PDCryptFillEncryptDictProc().
The security data should be allocated by ASmalloc() or a related function. Security data is freed using PDCryptFreeSecurityDataProc(). If PDCryptFreeSecurityDataProc() is not defined, ASfree() is used.
The callback can also update the security handler itself. For example, the standard encryption handler switches to no encryption if no passwords or permissions are set in the security dialog box. Return ASAtomNull in cryptHandler
if no encryption is used in the saved file.
ASBool
PDCryptUpdateSecurityDataProc(
PDDoc
pdDoc
,
ASAtom
*
cryptHandler
,
void
*
*
secDataP
);
pdDoc | The document whose security data is updated.
|
cryptHandler | The current security handler for
pdDoc . It can be modified to change the security handler. Encryption is turned off if ASAtomNull is set. |
secDataP | (Required) A security data structure. Its content and organization is up to the security handler.
|
true
unless the operation should be cancelled (for example, the user clicked on the Cancel button). (Optional) A callback for PDCryptHandler. It validates the security data structure, which specifies the user's permissions. This callback may modify the security data structure (for example, because the user is not authorized to change the security as they requested). A client may have called PDDocNewSecurityData() to obtain a new security data structure, then modified it, and then called PDDocSetNewSecurityData() to change the document security. This callback should be called before actually setting the document's security data.
This callback is not called automatically by the Acrobat viewer. It must be called, if desired, by the security handler's PDCryptUpdateSecurityDataProc().
void
PDCryptValidateSecurityDataProc(
PDDoc
pdDoc
,
void
*
secData
);
pdDoc | IN/OUT The document whose security data is validated.
|
secData | IN/OUT (May be modified by the callback) The document's security data.
|
| |
Set this to
sizeof(PDCryptBatchHandlerRec) . | |
This function should display a dialog box that allows a user to enter data that will be used to batch secure a series of files. The data is stored in an ASCab which is part of a Batch sequence file. The actual security data, including password(s), should be stored as a pointer in the ASCabinet so that password information is not serialized to disk. Pointers are not serialized from ASCab objects, but ASText objects, ASInt32 objects, and ASBool objects are serialized.
| |
The developer should provide information about the current batch settings for the security handler. Batch settings are provided as a read-only ASCab which is passed in to the function. A writeable ASCab is also provided, which should be used to store parameter information about the security handler. The description information should be stored starting in the
paramDesc ASCab using ASText objects starting with key "1" . | |
This is different from the regular PDCryptHandler This authorization data is collected before any files are opened in the Batch sequence. It is permitted to display a user interface at this point since the Batch operation has not started yet. The data applies to all files, and therefore could represent one or more passwords which can be enumerated in the | |
Called when a PDF file is opened. It is first called with
NULL authData for the case without a user password. It is called again with authorization data provided for the security handler that matches the one used in the PDF file. During a Batch operation, a file will first be opened with the pdPermSecure bit set. It will then be opened with the pdPermOpen bit set. | |
This function should update the crypt handler's security data without bringing up a dialog. This data is provided by a PDCryptShowBatchDialogProc(). The current security data can be obtained by calling PDDocGetNewSecurityData(). This function should return
true unless there is a problem with the batch data for this security handler. | |
This function is called at the beginning of a Batch sequence before any files have been opened. This allows a security handler to be called back with the ASCab of settings that were filled out by the BatchShowDialog() function, or by an ASCabinet that was read in from disk. Pointers of security information are not serialized to disk, and therefore a security information structure may need to be regenerated based on other security information in the ASCabinet. It is permitted for the
If this function returns | |
This function is called at the end of a Batch sequence after all files have been processed. Any memory that was allocated in the
BatchPreSequence call should be cleaned up in this callback. | |
|
DecryptStream
callback can be NULL
if the crypt filter handler does not perform encryption/decryption on its own. In such cases, GetDataProc
must be supplied.0
length buffer (or EOF) when unauthorized access is made.
The CryptStringProcs
string callback is expected to return the desired buffer size (the required destination buffer length) when NULL
is passed as the destination buffer. This mechanism is to allow a different buffer length upon encryption/decryption.
About the ASCryptStm in the callback: upon the first call (back) to Encrypt/Decrypt stream procs, the handler is expected to fill out an ASCryptStmRec. ASCryptStm has pointers to callback routines for various stream access. Subsequent stream access is made to these callback routines. See ASExpT.h for the ASCryptStmRec definition.
| |
Set this to
sizeof(PDCryptFilterHandlerRec) . | |
Called to get crypt data when the application's built-in method is used.
| |
|
| |
Set this to
sizeof(PDCryptHandlerRec) . PDRegisterCryptHandler uses this to determine if the caller was compiled with an old version of this structure declaration. PDRegisterCryptHandler() will raise genErrBadParam if the size does not correspond to a known size of this struct . | |
This function will be called when a user tries to open or set security for an encrypted document. If this function is called to authorize Open, decryption will not yet have been installed. So while any part of the document may be examined, some calls must be avoided. For example, a call that causes a page to be parsed will probably result in an error since the encrypted contents will be parsed. In general, it is safe to obtain information about the presence or absence of things, or the number of things, and to examine any part of a document at the Cos level. | |
Creates and returns a new
struct that can be filled out and passed to Authorize and eventually to ASfree(). This function is not called by the standard security mechanism but may be called by extensions that want to gain access to a protected document. This function need not be implemented if clients can simply allocate data using ASmalloc(). In fact, the standard CryptHandler does not. | |
This function obtains authorization data from the user. As with
Authorize , permsWanted will be either pdPermOpen or pdPermSecure . This function should allocate authData to be used by Authorize . The function should return true unless the operation should be cancelled (for example, if the user cancels a dialog). A crypt handler can specify the standard password dialog box by using AVCryptGetPassword(). In this case, the authData will be a char * that should be freed using ASfree() after Authorize is called. | |
Creates a new
struct that contains information corresponding to information in the security dialog. If encryptDict is a dictionary, initialize the security data to correspond to the dictionary. Otherwise, set up defaults. This function will be called when opening a document with encryptDict set to the document's encryptDict . It will also be called when a user chooses new encryption. | |
Validates the security data, modifying it as necessary. A client may have called PDDocNewSecurityData() to obtain a new security data structure, then modified it, and then called PDDocSetNewSecurityData() to change the document security. This is called before actually setting the document's security data.
| |
This function should update the crypt handler's security data, usually by displaying a dialog. The current security data can be obtained by calling PDDocGetNewSecurityData(). Like
GetAuthData , this function should return true unless cancelled. The security data should be created with ASmalloc() so that it can later be freed by ASfree(). The function can also update the cryptHandler itself. For example, the built-in encryption switches to no encryption if no passwords or permissions are set in the security dialog. | |
This function should fill the encryption dictionary with whatever information is to be stored in the document. Unlike all other strings and streams, direct object elements of the encryption dictionary are not encrypted automatically. They must be encrypted before they are inserted into the dictionary.
| |
This function should return information about security for display to the user: whether the document has owner and user passwords and whether the user password enables printing, editing, copying text and graphics, and editing notes. See PDexpt.h for possible permissions. All other bits in
secInfo should be set to 1 . This function is also used after a SaveAs to reset the permissions according to the current document. | |
If provided, this must be used to free
securityData acquired via NewSecurityData . | |
If provided, must be used to free
authData acquired via GetAuthData or NewAuthData . | |
If provided, this must be used to free
cryptData acquired via NewCryptData . | |
Sets up the key to be passed to initialize the RC4 cipher and the version of algorithm for encryption and decryption. The key will be truncated when the length is greater than the viewer currently supports. Data will be freed by
FreeCryptData if provided. Otherwise, ASfree() is used. | |
This was added to replace PDCryptGetAuthDataProc(). There are now new permission controls. PDPerms are obsolete. Yet, the viewer still supports the old security handler. It is called whenever the viewer needs to get authorization data and/or check permission for operation(s).
| |
This was added to replace PDCryptGetAuthDataProc(). There are now new permission controls. PDPerms are obsolete. Yet, the viewer still supports the old security handler. It is called whenever the viewer needs to get authorization data and/or check permission for operation(s).
| |
When the security handler is called, it should pop up a dialog box with current permission settings. This callback was added to provide the security handler with a way to display its custom permission settings. It should return
true if it wants a callback to modify security settings. Otherwise, it should return false . | |
Used for the Acrobat Web Buy proprietary method of passing encrypted data.
| |
A pointer to the PDCryptBatchHandler structure. If this parameter is non-
NULL , the security handler will work in a Batch environment, either for decrypting PDF files or encrypting them on Save with a new security handler. | |
This call is used to provide PDCrypt handler interoperability. When an encrypted ducument is being opened and the security handler specified in the encryption dictionary is not present, the viewer will call this function on existing security handlers to see if one of them can be used to open the document.
| |
A pointer to the PDCryptFilterHandler structure. If this parameter is non-
NULL , the security handler supports the Crypt Filter. | |
This function should return information about the document permissions for display to the user: whether the user can print, edit, copy text and graphics, edit notes and do form fill in and signing. See PDexpt.h for possible permissions.
| |
It determines whether a document's metadata will be encrypted. If this call is not implemented, the metadata is always encrypted.
| |
Used for opening a rolled back document (the original portion of a signed document). If this call is not implemented, the security handler is asked for authorization. Since authorization is already requested for the document, this would be the second authorization call for the rolled back part. The callee is expected to authorize the opening of this document using an already opened document, including the subsequent callback to authorize the Crypt Filter(s). | |
Used by Acrobat to display user interface information about the document.
| |
|
ASBool
PDCryptAuthorizeFilterAccess(
PDDoc
doc
,
ASAtom
handlerName
,
ASAtom
filterName
,
ASBool
bEncrypt
);
doc | The document containing the embedded file whose filter access is requested.
|
handlerName | The security handler containing the Authorize() callback procedure to run.
|
filterName | The ASAtom corresponding to the name of the security filter used by the embedded file.
|
bEncrypt |
is raised if there is no security handler registered for the document.
|
void
PDRegisterCryptHandler(
PDCryptHandler
handler
,
const
char
*
pdfName
,
const
char
*
userName
);
handler | A pointer to a structure that contains the security handler's callback functions. This structure must not be freed after calling PDRegisterCryptHandler().
|
pdfName | The name of the security handler as it will appear in the PDF file. This name is also used by PDDocSetNewCryptHandler(). Storage for this name can be freed after PDRegisterCryptHandler() has been called.
|
userName | The name of the security handler as it will be shown in menus. This name can be localized into different languages. Storage for this name can be freed after PDRegisterCryptHandler() has been called.
|
is raised if the security handler's size field is incorrect.
| |
is raised if either
pdfName or userName are already in use by a registered security handler. | |
is raised is memory is exhausted. Other exceptions may be raised as well.
|
void
PDRegisterCryptHandlerEx(
PDCryptHandler
handler
,
const
char
*
pdfName
,
const
char
*
userName
,
void
*
clientData
);
handler | A pointer to a structure that contains the security handler's callback functions. This structure must not be freed after calling PDRegisterCryptHandlerEx().
|
pdfName | The name of the security handler as it will appear in the PDF file. This name is also used by PDDocSetNewCryptHandler(). Storage for this name can be freed after PDRegisterCryptHandlerEx() has been called.
|
userName | The name of the security handler as it will be shown in menus. This name can be localized to different languages. Storage for this name can be freed after PDRegisterCryptHandlerEx() has been called.
|
clientData | A pointer to user-supplied data to store with the handler.
|
is raised if the security handler's size field is incorrect.
| |
is raised if either pdfName or userName are already in use by a registered security handler.
| |
is raised is memory is exhausted.
|