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 |
| | 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.
|
| |
|
|
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 |
◆ 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
◆ CreateDocumentId()
| 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 |
◆ 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.
- Returns
- The key length in bits
◆ GetOEValue()
| const std::string & wxPdfEncrypt::GetOEValue |
( |
| ) |
const |
|
inline |
Get the OE object value (owner)
- Returns
- The owner encryption key verification value
◆ GetOValue()
| const std::string & wxPdfEncrypt::GetOValue |
( |
| ) |
const |
|
inline |
Get the O object value (owner)
- Returns
- The owner verification value
◆ GetPermsValue()
| const std::string & wxPdfEncrypt::GetPermsValue |
( |
| ) |
const |
|
inline |
Get the Perms object value (protection)
- Returns
- The permissions verification value
◆ GetPValue()
| int wxPdfEncrypt::GetPValue |
( |
| ) |
const |
|
inline |
Get the P object value (protection)
- Returns
- The protection flags
◆ GetRevision()
| int wxPdfEncrypt::GetRevision |
( |
| ) |
const |
|
inline |
Get the revision number of the encryption method.
- Returns
- The encryption revision
◆ GetUEValue()
| const std::string & wxPdfEncrypt::GetUEValue |
( |
| ) |
const |
|
inline |
Get the UE object value (user)
- Returns
- The user encryption key verification value
◆ GetUValue()
| const std::string & wxPdfEncrypt::GetUValue |
( |
| ) |
const |
|
inline |
Get the U object value (user)
- Returns
- The user verification value
◆ PasswordIsValid()
| bool wxPdfEncrypt::PasswordIsValid |
( |
const wxString & |
password | ) |
const |
Check whether the given password is valid.
- Parameters
-
| password | The password to check |
- Returns
true if the password is valid, false otherwise
◆ RC4()
| void wxPdfEncrypt::RC4 |
( |
unsigned char * |
key, |
|
|
unsigned int |
keylen, |
|
|
const unsigned char * |
textin, |
|
|
unsigned int |
textlen, |
|
|
unsigned char * |
textout |
|
) |
| |
|
protected |
RC4 encryption.
RC4 is the standard encryption algorithm used in PDF format.
The documentation for this class was generated from the following files: