This structure describes the data for the standard security handler.
Declaration:
|
Copy Code
|
typedef struct tagAT_PDF_SECURITYDATA
{
AT_UINT size;
AT_PDF_BOOL newUserPW;
AT_PDF_BOOL hasUserPW;
CHAR userPW[256];
AT_PDF_BOOL newOwnerPW;
AT_PDF_BOOL hasOwnerPW;
CHAR ownerPW[256];
AT_DWORD perms;
LONG keyLength;
AT_INT32 revision;
AT_PDF_BOOL encryptMetadata;
LONG encryptMethod;
AT_PDF_BOOL encryptAttachmentsOnly;
AT_INT32 version;
} AT_PDF_SECURITYDATA;
typedef AT_PDF_SECURITYDATA FAR* LPAT_PDF_SECURITYDATA;
|
Members:
Name |
Type |
Description |
size |
AT_UINT |
Size of this structure. |
newUserPW |
AT_PDF_BOOL |
TRUE if the user password should be changed. |
hasUserPW |
AT_PDF_BOOL |
TRUE if there is a user password. |
userPW |
CHAR[256] |
The user password string. |
newOwnerPW |
AT_PDF_BOOL |
TRUE if the owner password should be changed; FALSE otherwise. |
hasOwnerPW |
AT_PDF_BOOL |
TRUE if an owner password is provided; FALSE otherwise. |
ownerPW |
CHAR[256] |
The owner password string. |
perms |
AT_DWORD |
Permissions to allow. An OR of the enumIGPDFPermsFlags values. |
keyLength |
LONG |
Encryption key length in bytes. |
revision |
AT_INT32 |
Indicates /R value. One of the enumIGPDFRevision values. |
encryptMetadata |
AT_PDF_BOOL |
Flag that indicates whether document metadata will be encrypted. |
encryptMethod |
LONG |
Method of encryption for filters to use. One of the enumIGPDFStdSecurityMethod values. |
encryptAttachmentsOnly |
AT_PDF_BOOL |
Flag to indicate that only Attachments are encrypted - encryptMetadata and encryptAttachmentsOnly cannot both be true. |
version |
AT_INT32 |
Indicates a /V value. One of the enumIGPDFStdSecurityVersion values. |
Remarks:
The password strings in PDF are padded or truncated to exactly 32 bytes. If the password string is more than 32 bytes long, used only its first 32 bytes; if it is less than 32 bytes long, it padded by appending the required number of additional bytes from the beginning of the following padding string: <28 BF 4E 5E 4E 75 8A 41 64 00 4E 56 FF FA 01 08 2E 2E 00 B6 D0 68 3E 80 2F 0C A9 FE 64 53 69 7A >
Not all combinations of encryptMethod, keyLength, version and revision are valid. An error is not returned for invalid combinations. Instead, a different valid combination is used to secure the PDF and a warning is added to the warning list. The following combinations are valid:
encryptMethod |
version |
revision |
keyLength |
IG_PDF_STD_SECURITY_METHOD_RC4_V2 |
IG_PDF_STD_SECURITY_VERSION_2 |
IG_PDF_REVISION_3 |
5 |
IG_PDF_STD_SECURITY_METHOD_RC4_V2 |
IG_PDF_STD_SECURITY_VERSION_2 |
IG_PDF_REVISION_3 |
16 |
IG_PDF_STD_SECURITY_METHOD_RC4_V2 |
IG_PDF_STD_SECURITY_VERSION_4 |
IG_PDF_REVISION_4 |
16 |
IG_PDF_STD_SECURITY_METHOD_AES_V2 |
IG_PDF_STD_SECURITY_VERSION_4 |
IG_PDF_REVISION_4 |
16 |
IG_PDF_STD_SECURITY_METHOD_AES_V3 |
IG_PDF_STD_SECURITY_VERSION_5 |
IG_PDF_REVISION_5 |
32 |
IG_PDF_STD_SECURITY_METHOD_AES_V3 |
IG_PDF_STD_SECURITY_VERSION_5 |
IG_PDF_REVISION_6 |
32 |