Class representing PDF encryption methods. (For internal use only)
More...
#include <pdfencrypt.h>
|
| wxPdfEncrypt (int revision=2, int keyLength=40) |
| Constructor. More...
|
|
virtual | ~wxPdfEncrypt () |
| Default destructor. More...
|
|
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. More...
|
|
bool | Authenticate (const wxString &documentID, const wxString &password, const wxString &uValue, const wxString &oValue, int pValue, int lengthValue, int rValue) |
| Authenticate a document. More...
|
|
const unsigned char * | GetUValue () const |
| Get the U object value (user) More...
|
|
const unsigned char * | GetOValue () const |
| Get the O object value (owner) More...
|
|
int | GetPValue () const |
| Get the P object value (protection) More...
|
|
int | GetRevision () const |
| Get the revision number of the encryption method. More...
|
|
unsigned int | GetKeyLength () const |
| Get the key length of the encryption key in bits. More...
|
|
void | Encrypt (int n, int g, wxString &str) |
| Encrypt a wxString. More...
|
|
void | Encrypt (int n, int g, unsigned char *str, unsigned int len) |
| Encrypt a character string. More...
|
|
size_t | CalculateStreamLength (size_t length) |
| Calculate stream size. More...
|
|
size_t | CalculateStreamOffset () |
| Calculate stream offset. More...
|
|
wxString | CreateDocumentId () |
| Create document id. More...
|
|
wxString | GetDocumentId () const |
| Get document id. More...
|
|
|
void | PadPassword (const wxString &password, unsigned char pswd[32]) |
| Pad a password to 32 characters. More...
|
|
void | ComputeOwnerKey (unsigned char userPad[32], unsigned char ownerPad[32], unsigned int keylength, int revision, bool authenticate, unsigned char ownerKey[32]) |
| Compute owner key. More...
|
|
void | ComputeEncryptionKey (const wxString &documentID, unsigned char userPad[32], unsigned char ownerKey[32], int pValue, unsigned int keyLength, int revision, unsigned char userKey[32]) |
| Compute encryption key and user key. More...
|
|
bool | CheckKey (unsigned char key1[32], unsigned char key2[32]) |
| Check two keys for equality. More...
|
|
void | RC4 (unsigned char *key, unsigned int keylen, unsigned char *textin, unsigned int textlen, unsigned char *textout) |
| RC4 encryption. More...
|
|
void | GetMD5Binary (const unsigned char *data, unsigned int length, unsigned char *digest) |
| Calculate the binary MD5 message digest of the given data. More...
|
|
void | AES (unsigned char *key, unsigned int keylen, unsigned char *textin, unsigned int textlen, unsigned char *textout) |
| AES encryption. More...
|
|
void | GenerateInitialVector (unsigned char iv[16]) |
| Generate initial vector. More...
|
|
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 |
◆ AES()
void wxPdfEncrypt::AES |
( |
unsigned char * |
key, |
|
|
unsigned int |
keylen, |
|
|
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, |
|
|
int |
pValue, |
|
|
int |
lengthValue, |
|
|
int |
rValue |
|
) |
| |
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 |
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 |
- Returns
- TRUE if the document could be authenticated successfully, FALSE otherwise
◆ CalculateStreamLength()
size_t wxPdfEncrypt::CalculateStreamLength |
( |
size_t |
length | ) |
|
Calculate stream size.
- Parameters
-
length | lenght 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 |
( |
unsigned char |
key1[32], |
|
|
unsigned char |
key2[32] |
|
) |
| |
|
protected |
Check two keys for equality.
◆ ComputeEncryptionKey()
void wxPdfEncrypt::ComputeEncryptionKey |
( |
const wxString & |
documentID, |
|
|
unsigned char |
userPad[32], |
|
|
unsigned char |
ownerKey[32], |
|
|
int |
pValue, |
|
|
unsigned int |
keyLength, |
|
|
int |
revision, |
|
|
unsigned char |
userKey[32] |
|
) |
| |
|
protected |
Compute encryption key and user key.
◆ ComputeOwnerKey()
void wxPdfEncrypt::ComputeOwnerKey |
( |
unsigned char |
userPad[32], |
|
|
unsigned char |
ownerPad[32], |
|
|
unsigned int |
keylength, |
|
|
int |
revision, |
|
|
bool |
authenticate, |
|
|
unsigned char |
ownerKey[32] |
|
) |
| |
|
protected |
◆ CreateDocumentId()
wxString wxPdfEncrypt::CreateDocumentId |
( |
| ) |
|
Create document id.
- Returns
- the created document identifier
◆ Encrypt() [1/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 |
◆ Encrypt() [2/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 |
◆ 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()
void wxPdfEncrypt::GenerateInitialVector |
( |
unsigned char |
iv[16] | ) |
|
|
protected |
◆ 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()
void wxPdfEncrypt::GetMD5Binary |
( |
const unsigned char * |
data, |
|
|
unsigned int |
length, |
|
|
unsigned char * |
digest |
|
) |
| |
|
protected |
Calculate the binary MD5 message digest of the given data.
◆ GetOValue()
const unsigned char* wxPdfEncrypt::GetOValue |
( |
| ) |
const |
|
inline |
Get the O object value (owner)
◆ 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.
◆ GetUValue()
const unsigned char* wxPdfEncrypt::GetUValue |
( |
| ) |
const |
|
inline |
Get the U object value (user)
◆ PadPassword()
void wxPdfEncrypt::PadPassword |
( |
const wxString & |
password, |
|
|
unsigned char |
pswd[32] |
|
) |
| |
|
protected |
Pad a password to 32 characters.
◆ RC4()
void wxPdfEncrypt::RC4 |
( |
unsigned char * |
key, |
|
|
unsigned int |
keylen, |
|
|
unsigned char * |
textin, |
|
|
unsigned int |
textlen, |
|
|
unsigned char * |
textout |
|
) |
| |
|
protected |
The documentation for this class was generated from the following file: