wxPdfEncrypt Class Reference

Class representing PDF encryption methods. (For internal use only). More...

#include <pdfencrypt.h>

List of all members.

Public Member Functions

 wxPdfEncrypt (int revision=2, int keyLength=40)
 Default constructor.
virtual ~wxPdfEncrypt ()
 Default destructor.
void GenerateEncryptionKey (const wxString &userPassword, const wxString &ownerPassword, int protection)
 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, int pValue, int lengthValue, int rValue)
const unsigned char * GetUValue () const
 Get the U object value (user).
const unsigned char * GetOValue () const
 Get the O object value (owner).
int GetPValue () const
 Get the P object value (protection).
int GetRevision () const
 Get the revision number of the encryption method.
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 Encrypt (int n, int g, unsigned char *str, int len)
 Encrypt a character string.
int CalculateStreamLength (int length)
 Calculate stream size.
int CalculateStreamOffset ()
 Calculate stream offset.
wxString CreateDocumentId ()
 Create document id.
wxString GetDocumentId () const
 Get document id.

Protected Member Functions

void PadPassword (const wxString &password, unsigned char pswd[32])
 Pad a password to 32 characters.
void ComputeOwnerKey (unsigned char userPad[32], unsigned char ownerPad[32], int keylength, int revision, bool authenticate, unsigned char ownerKey[32])
 Compute owner key.
void ComputeEncryptionKey (const wxString &documentID, unsigned char userPad[32], unsigned char ownerKey[32], int pValue, int keyLength, int revision, unsigned char userKey[32])
 Compute encryption key and user key.
bool CheckKey (unsigned char key1[32], unsigned char key2[32])
 Check two keys for equality.
void RC4 (unsigned char *key, int keylen, unsigned char *textin, int textlen, unsigned char *textout)
 RC4 encryption.
void GetMD5Binary (const unsigned char *data, int length, unsigned char *digest)
 Calculate the binary MD5 message digest of the given data.
void AES (unsigned char *key, int WXUNUSED(keylen), unsigned char *textin, int textlen, unsigned char *textout)
 AES encryption.
void GenerateInitialVector (unsigned char iv[16])
 Generate initial vector.


Detailed Description

Class representing PDF encryption methods. (For internal use only).


Constructor & Destructor Documentation

wxPdfEncrypt::wxPdfEncrypt ( int  revision = 2,
int  keyLength = 40 
)

Default constructor.

wxPdfEncrypt::~wxPdfEncrypt (  )  [virtual]

Default destructor.


Member Function Documentation

void wxPdfEncrypt::GenerateEncryptionKey ( const wxString &  userPassword,
const wxString &  ownerPassword,
int  protection 
)

Generate encryption key from user and owner passwords and protection key.

bool wxPdfEncrypt::Authenticate ( const wxString &  documentID,
const wxString &  password,
const wxString &  uValue,
const wxString &  oValue,
int  pValue,
int  lengthValue,
int  rValue 
)

const unsigned char* wxPdfEncrypt::GetUValue (  )  const [inline]

Get the U object value (user).

const unsigned char* wxPdfEncrypt::GetOValue (  )  const [inline]

Get the O object value (owner).

int wxPdfEncrypt::GetPValue (  )  const [inline]

Get the P object value (protection).

int wxPdfEncrypt::GetRevision (  )  const [inline]

Get the revision number of the encryption method.

int wxPdfEncrypt::GetKeyLength (  )  const [inline]

Get the key length of the encryption key in bits.

void wxPdfEncrypt::Encrypt ( int  n,
int  g,
wxString &  str 
)

Encrypt a wxString.

void wxPdfEncrypt::Encrypt ( int  n,
int  g,
unsigned char *  str,
int  len 
)

Encrypt a character string.

int wxPdfEncrypt::CalculateStreamLength ( int  length  ) 

Calculate stream size.

int wxPdfEncrypt::CalculateStreamOffset (  ) 

Calculate stream offset.

wxString wxPdfEncrypt::CreateDocumentId (  ) 

Create document id.

wxString wxPdfEncrypt::GetDocumentId (  )  const [inline]

Get document id.

void wxPdfEncrypt::PadPassword ( const wxString &  password,
unsigned char  pswd[32] 
) [protected]

Pad a password to 32 characters.

void wxPdfEncrypt::ComputeOwnerKey ( unsigned char  userPad[32],
unsigned char  ownerPad[32],
int  keylength,
int  revision,
bool  authenticate,
unsigned char  ownerKey[32] 
) [protected]

Compute owner key.

void wxPdfEncrypt::ComputeEncryptionKey ( const wxString &  documentID,
unsigned char  userPad[32],
unsigned char  ownerKey[32],
int  pValue,
int  keyLength,
int  revision,
unsigned char  userKey[32] 
) [protected]

Compute encryption key and user key.

bool wxPdfEncrypt::CheckKey ( unsigned char  key1[32],
unsigned char  key2[32] 
) [protected]

Check two keys for equality.

void wxPdfEncrypt::RC4 ( unsigned char *  key,
int  keylen,
unsigned char *  textin,
int  textlen,
unsigned char *  textout 
) [protected]

RC4 encryption.

RC4 is the standard encryption algorithm used in PDF format

void wxPdfEncrypt::GetMD5Binary ( const unsigned char *  data,
int  length,
unsigned char *  digest 
) [protected]

Calculate the binary MD5 message digest of the given data.

void wxPdfEncrypt::AES ( unsigned char *  key,
int   WXUNUSED(keylen),
unsigned char *  textin,
int  textlen,
unsigned char *  textout 
) [protected]

AES encryption.

void wxPdfEncrypt::GenerateInitialVector ( unsigned char  iv[16]  )  [protected]

Generate initial vector.


The documentation for this class was generated from the following files:
Generated on Fri Dec 15 21:30:37 2006 for wxPdfDocument by  doxygen 1.5.1-p1