![]() |
wxPdfDocument
1.4.0
Library for generating PDF documents from wxWidgets applications
|
#include <pdfencrypt.h>
Public Member Functions | |
| wxPdfEncrypt (int revision=2, int keyLength=40) | |
| Constructor. | |
| virtual | ~wxPdfEncrypt () |
| Default destructor. | |
| void | GenerateEncryptionKey (const wxString &userPassword, const wxString &ownerPassword, int protection, const wxString &documentId=wxEmptyString) |
| Generate encryption key from user and owner passwords and protection key. | |
| bool | Authenticate (const wxString &documentID, const wxString &password, const wxString &uValue, const wxString &oValue, const wxString &ueValue, const wxString &oeValue, const wxString &permsValue, int pValue, int lengthValue, int rValue, int vValue) |
| Authenticate a document. | |
| bool | PasswordIsValid (const wxString &password) const |
| Check whether the given password is valid. | |
| const std::string & | GetUValue () const |
| Get the U object value (user). | |
| const std::string & | GetUEValue () const |
| Get the UE object value (user). | |
| const std::string & | GetOValue () const |
| Get the O object value (owner). | |
| const std::string & | GetOEValue () const |
| Get the OE object value (owner). | |
| int | GetPValue () const |
| Get the P object value (protection). | |
| const std::string & | GetPermsValue () const |
| Get the Perms object value (protection). | |
| int | GetRevision () const |
| Get the revision number of the encryption method. | |
| unsigned int | GetKeyLength () const |
| Get the key length of the encryption key in bits. | |
| void | Encrypt (int n, int g, wxString &str) |
| Encrypt a wxString. | |
| void | Decrypt (int n, int g, wxString &str) |
| Decrypt a wxString. | |
| void | Encrypt (int n, int g, unsigned char *str, unsigned int len) |
| Encrypt a character string. | |
| int | Decrypt (int n, int g, unsigned char *str, unsigned int len) |
| Decrypt a character string. | |
| size_t | CalculateStreamLength (size_t length) |
| Calculate stream size. | |
| size_t | CalculateStreamOffset () |
| Calculate stream offset. | |
| wxString | GetDocumentId () const |
| Get document id. | |
Static Public Member Functions | |
| static wxString | CreateDocumentId () |
| Create document id. | |
Protected Member Functions | |
| std::string | PadPassword (const wxString &password) |
| Pad a password to 32 characters. | |
| std::string | ComputeOwnerKey (const std::string &userPad, const std::string &ownerPad, unsigned int keylength, int revision, bool authenticate) |
| Compute owner key. | |
| std::string | ComputeEncryptionKey (const wxString &documentID, const std::string &userPad, const std::string &ownerKey, int pValue, unsigned int keyLength, int revision) |
| Compute encryption key and user key. | |
| bool | CheckKey (const std::string &key1, const std::string &key2) |
| Check two keys for equality. | |
| void | RC4 (unsigned char *key, unsigned int keylen, const unsigned char *textin, unsigned int textlen, unsigned char *textout) |
| RC4 encryption. | |
| void | AESEncrypt (unsigned char *key, unsigned int keylen, unsigned char *textin, unsigned int textlen, unsigned char *textout) |
| AES-128 encryption. | |
| int | AESDecrypt (unsigned char *key, unsigned int keylen, unsigned char *textin, unsigned int textlen, unsigned char *textout) |
| AES-128 decryption. | |
| void | AESV3Encrypt (const unsigned char *key, unsigned int keylen, const unsigned char *textin, unsigned int textlen, unsigned char *textout) |
| AES-256 encryption. | |
| int | AESV3Decrypt (const unsigned char *key, unsigned int keylen, unsigned char *textin, unsigned int textlen, unsigned char *textout) |
| AES-256 decryption. | |
Static Protected Member Functions | |
| static void | GetMD5Binary (const unsigned char *data, unsigned int length, unsigned char *digest) |
| Calculate the binary MD5 message digest of the given data. | |
| static void | GenerateInitialVector (unsigned char iv[16]) |
| Generate initial vector. | |
Class representing PDF encryption methods. (For internal use only)
| wxPdfEncrypt::wxPdfEncrypt | ( | int | revision = 2, |
| int | keyLength = 40 ) |
Constructor.
| revision | revision of the encryption algorithm |
| keyLength | length of the key for the encryption |
|
virtual |
Default destructor.
|
protected |
AES-128 decryption.
|
protected |
AES-128 encryption.
|
protected |
AES-256 decryption.
|
protected |
AES-256 encryption.
| bool wxPdfEncrypt::Authenticate | ( | const wxString & | documentID, |
| const wxString & | password, | ||
| const wxString & | uValue, | ||
| const wxString & | oValue, | ||
| const wxString & | ueValue, | ||
| const wxString & | oeValue, | ||
| const wxString & | permsValue, | ||
| int | pValue, | ||
| int | lengthValue, | ||
| int | rValue, | ||
| int | vValue ) |
Authenticate a document.
| documentID | the identification of the document |
| password | the password given by the user |
| uValue | the U value from the document's encryption dictionary |
| oValue | the O value from the document's encryption dictionary |
| ueValue | the UE value from the document's encryption dictionary |
| oeValue | the OE value from the document's encryption dictionary |
| permsValue | the Perms value from the document's encryption dictionary |
| pValue | the P value from the document's encryption dictionary |
| lengthValue | the length value from the document's encryption dictionary |
| rValue | the R value from the document's encryption dictionary |
| vValue | the V value from the document's encryption dictionary |
true if the document could be authenticated successfully, false otherwise | size_t wxPdfEncrypt::CalculateStreamLength | ( | size_t | length | ) |
Calculate stream size.
| length | length of the original stream |
| size_t wxPdfEncrypt::CalculateStreamOffset | ( | ) |
Calculate stream offset.
|
protected |
Check two keys for equality.
|
protected |
Compute encryption key and user key.
|
protected |
Compute owner key.
|
static |
Create document id.
| int wxPdfEncrypt::Decrypt | ( | int | n, |
| int | g, | ||
| unsigned char * | str, | ||
| unsigned int | len ) |
Decrypt a character string.
| n | number of the associated PDF object |
| g | generation of the associated PDF object |
| str | string to decrypt |
| len | length of the string to decrypt |
| void wxPdfEncrypt::Decrypt | ( | int | n, |
| int | g, | ||
| wxString & | str ) |
Decrypt a wxString.
| n | number of the associated PDF object |
| g | generation of the associated PDF object |
| str | string to decrypt |
| void wxPdfEncrypt::Encrypt | ( | int | n, |
| int | g, | ||
| unsigned char * | str, | ||
| unsigned int | len ) |
Encrypt a character string.
| n | number of the associated PDF object |
| g | generation of the associated PDF object |
| str | string to encrypt |
| len | length of the string to encrypt |
| void wxPdfEncrypt::Encrypt | ( | int | n, |
| int | g, | ||
| wxString & | str ) |
Encrypt a wxString.
| n | number of the associated PDF object |
| g | generation of the associated PDF object |
| str | string to encrypt |
| void wxPdfEncrypt::GenerateEncryptionKey | ( | const wxString & | userPassword, |
| const wxString & | ownerPassword, | ||
| int | protection, | ||
| const wxString & | documentId = wxEmptyString ) |
Generate encryption key from user and owner passwords and protection key.
| userPassword | password of the user |
| ownerPassword | password of the owner |
| protection | protection flags |
| documentId | optional document identification |
|
staticprotected |
Generate initial vector.
|
inline |
Get document id.
|
inline |
Get the key length of the encryption key in bits.
|
staticprotected |
Calculate the binary MD5 message digest of the given data.
|
inline |
Get the OE object value (owner).
|
inline |
Get the O object value (owner).
|
inline |
Get the Perms object value (protection).
|
inline |
Get the P object value (protection).
|
inline |
Get the revision number of the encryption method.
|
inline |
Get the UE object value (user).
|
inline |
Get the U object value (user).
|
protected |
Pad a password to 32 characters.
| bool wxPdfEncrypt::PasswordIsValid | ( | const wxString & | password | ) | const |
Check whether the given password is valid.
| password | The password to check |
true if the password is valid, false otherwise
|
protected |
RC4 encryption.