Class representing PDF encryption methods. (For internal use only)
More...
#include <pdfencrypt.h>
|
| | 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 |
| |
| 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.
|
| |
|
| 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 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::wxPdfEncrypt |
( |
int | revision = 2, |
|
|
int | keyLength = 40 ) |
Constructor.
- Parameters
-
| revision | revision of the encryption algorithm |
| keyLength | length of the key for the encryption |
◆ ~wxPdfEncrypt()
| virtual wxPdfEncrypt::~wxPdfEncrypt |
( |
| ) |
|
|
virtual |
◆ AESDecrypt()
| int wxPdfEncrypt::AESDecrypt |
( |
unsigned char * | key, |
|
|
unsigned int | keylen, |
|
|
unsigned char * | textin, |
|
|
unsigned int | textlen, |
|
|
unsigned char * | textout ) |
|
protected |
◆ AESEncrypt()
| void wxPdfEncrypt::AESEncrypt |
( |
unsigned char * | key, |
|
|
unsigned int | keylen, |
|
|
unsigned char * | textin, |
|
|
unsigned int | textlen, |
|
|
unsigned char * | textout ) |
|
protected |
◆ AESV3Decrypt()
| int wxPdfEncrypt::AESV3Decrypt |
( |
const unsigned char * | key, |
|
|
unsigned int | keylen, |
|
|
unsigned char * | textin, |
|
|
unsigned int | textlen, |
|
|
unsigned char * | textout ) |
|
protected |
◆ AESV3Encrypt()
| void wxPdfEncrypt::AESV3Encrypt |
( |
const unsigned char * | key, |
|
|
unsigned int | keylen, |
|
|
const unsigned char * | textin, |
|
|
unsigned int | textlen, |
|
|
unsigned char * | textout ) |
|
protected |
◆ Authenticate()
| 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.
- Parameters
-
| 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 |
- Returns
- TRUE if the document could be authenticated successfully, FALSE otherwise
◆ CalculateStreamLength()
| size_t wxPdfEncrypt::CalculateStreamLength |
( |
size_t | length | ) |
|
Calculate stream size.
- Parameters
-
| length | length of the original stream |
- Returns
- the length of the encrypted stream
◆ CalculateStreamOffset()
| size_t wxPdfEncrypt::CalculateStreamOffset |
( |
| ) |
|
Calculate stream offset.
- Returns
- the offset of the stream
◆ CheckKey()
| bool wxPdfEncrypt::CheckKey |
( |
const std::string & | key1, |
|
|
const std::string & | key2 ) |
|
protected |
Check two keys for equality.
◆ ComputeEncryptionKey()
| std::string wxPdfEncrypt::ComputeEncryptionKey |
( |
const wxString & | documentID, |
|
|
const std::string & | userPad, |
|
|
const std::string & | ownerKey, |
|
|
int | pValue, |
|
|
unsigned int | keyLength, |
|
|
int | revision ) |
|
protected |
Compute encryption key and user key.
◆ ComputeOwnerKey()
| std::string wxPdfEncrypt::ComputeOwnerKey |
( |
const std::string & | userPad, |
|
|
const std::string & | ownerPad, |
|
|
unsigned int | keylength, |
|
|
int | revision, |
|
|
bool | authenticate ) |
|
protected |
◆ CreateDocumentId()
| static wxString wxPdfEncrypt::CreateDocumentId |
( |
| ) |
|
|
static |
Create document id.
- Returns
- the created document identifier
◆ Decrypt() [1/2]
| int wxPdfEncrypt::Decrypt |
( |
int | n, |
|
|
int | g, |
|
|
unsigned char * | str, |
|
|
unsigned int | len ) |
Decrypt a character string.
- Parameters
-
| 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 |
◆ Decrypt() [2/2]
| void wxPdfEncrypt::Decrypt |
( |
int | n, |
|
|
int | g, |
|
|
wxString & | str ) |
Decrypt a wxString.
- Parameters
-
| n | number of the associated PDF object |
| g | generation of the associated PDF object |
| str | string to decrypt |
◆ Encrypt() [1/2]
| void wxPdfEncrypt::Encrypt |
( |
int | n, |
|
|
int | g, |
|
|
unsigned char * | str, |
|
|
unsigned int | len ) |
Encrypt a character string.
- Parameters
-
| 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 |
◆ Encrypt() [2/2]
| void wxPdfEncrypt::Encrypt |
( |
int | n, |
|
|
int | g, |
|
|
wxString & | str ) |
Encrypt a wxString.
- Parameters
-
| n | number of the associated PDF object |
| g | generation of the associated PDF object |
| str | string to encrypt |
◆ GenerateEncryptionKey()
| 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.
- Parameters
-
| userPassword | password of the user |
| ownerPassword | password of the owner |
| protection | protection flags |
| documentId | optional document identification |
◆ GenerateInitialVector()
| static void wxPdfEncrypt::GenerateInitialVector |
( |
unsigned char | iv[16] | ) |
|
|
staticprotected |
◆ GetDocumentId()
| wxString wxPdfEncrypt::GetDocumentId |
( |
| ) |
const |
|
inline |
Get document id.
- Returns
- the associated document identifier
◆ GetKeyLength()
| unsigned int wxPdfEncrypt::GetKeyLength |
( |
| ) |
const |
|
inline |
Get the key length of the encryption key in bits.
◆ GetMD5Binary()
| static void wxPdfEncrypt::GetMD5Binary |
( |
const unsigned char * | data, |
|
|
unsigned int | length, |
|
|
unsigned char * | digest ) |
|
staticprotected |
Calculate the binary MD5 message digest of the given data.
◆ GetOEValue()
| const std::string & wxPdfEncrypt::GetOEValue |
( |
| ) |
const |
|
inline |
Get the OE object value (owner)
◆ GetOValue()
| const std::string & wxPdfEncrypt::GetOValue |
( |
| ) |
const |
|
inline |
Get the O object value (owner)
◆ GetPermsValue()
| const std::string & wxPdfEncrypt::GetPermsValue |
( |
| ) |
const |
|
inline |
Get the Perms object value (protection)
◆ GetPValue()
| int wxPdfEncrypt::GetPValue |
( |
| ) |
const |
|
inline |
Get the P object value (protection)
◆ GetRevision()
| int wxPdfEncrypt::GetRevision |
( |
| ) |
const |
|
inline |
Get the revision number of the encryption method.
◆ GetUEValue()
| const std::string & wxPdfEncrypt::GetUEValue |
( |
| ) |
const |
|
inline |
Get the UE object value (user)
◆ GetUValue()
| const std::string & wxPdfEncrypt::GetUValue |
( |
| ) |
const |
|
inline |
Get the U object value (user)
◆ PadPassword()
| std::string wxPdfEncrypt::PadPassword |
( |
const wxString & | password | ) |
|
|
protected |
Pad a password to 32 characters.
◆ PasswordIsValid()
| bool wxPdfEncrypt::PasswordIsValid |
( |
const wxString & | password | ) |
const |
◆ RC4()
| void wxPdfEncrypt::RC4 |
( |
unsigned char * | key, |
|
|
unsigned int | keylen, |
|
|
const unsigned char * | textin, |
|
|
unsigned int | textlen, |
|
|
unsigned char * | textout ) |
|
protected |
The documentation for this class was generated from the following file: