PoDoFo
0.9.1
|
#include <PdfEncrypt.h>
Public Member Functions | |
void | Encrypt (unsigned char *str, pdf_long len) const |
Encrypt a character string. | |
PdfInputStream * | CreateEncryptionInputStream (PdfInputStream *pInputStream) |
PdfOutputStream * | CreateEncryptionOutputStream (PdfOutputStream *pOutputStream) |
void | CreateEncryptionDictionary (PdfDictionary &rDictionary) const |
![]() | |
virtual | ~PdfEncrypt () |
const PdfEncrypt & | operator= (const PdfEncrypt &rhs) |
void | GenerateEncryptionKey (const PdfString &documentId) |
bool | Authenticate (const std::string &password, const PdfString &documentId) |
EPdfEncryptAlgorithm | GetEncryptAlgorithm () const |
bool | IsPrintAllowed () const |
bool | IsEditAllowed () const |
bool | IsCopyAllowed () const |
bool | IsEditNotesAllowed () const |
bool | IsFillAndSignAllowed () const |
bool | IsAccessibilityAllowed () const |
bool | IsDocAssemblyAllowed () const |
bool | IsHighPrintAllowed () const |
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 (std::string &str, pdf_long inputLen) const |
Encrypt a wxString. | |
virtual pdf_long | CalculateStreamLength (pdf_long length) const |
Calculate stream size. | |
virtual pdf_long | CalculateStreamOffset () const |
Calculate stream offset. | |
void | SetCurrentReference (const PdfReference &rRef) |
Additional Inherited Members | |
![]() | |
enum | EPdfKeyLength |
enum | EPdfPermissions { ePdfPermissions_Print = 0x00000004, ePdfPermissions_Edit = 0x00000008, ePdfPermissions_Copy = 0x00000010, ePdfPermissions_EditNotes = 0x00000020, ePdfPermissions_FillAndSign = 0x00000100, ePdfPermissions_Accessible = 0x00000200, ePdfPermissions_DocAssembly = 0x00000400, ePdfPermissions_HighPrint = 0x00000800 } |
enum | EPdfEncryptAlgorithm { ePdfEncryptAlgorithm_RC4V1 = 1, ePdfEncryptAlgorithm_RC4V2 = 2, ePdfEncryptAlgorithm_AESV2 = 4 } |
![]() | |
static PdfEncrypt * | CreatePdfEncrypt (const std::string &userPassword, const std::string &ownerPassword, int protection=ePdfPermissions_Print|ePdfPermissions_Edit|ePdfPermissions_Copy|ePdfPermissions_EditNotes|ePdfPermissions_FillAndSign|ePdfPermissions_Accessible|ePdfPermissions_DocAssembly|ePdfPermissions_HighPrint, EPdfEncryptAlgorithm eAlgorithm=ePdfEncryptAlgorithm_RC4V1, EPdfKeyLength eKeyLength=ePdfKeyLength_40) |
static PdfEncrypt * | CreatePdfEncrypt (const PdfObject *pObject) |
static PdfEncrypt * | CreatePdfEncrypt (const PdfEncrypt &rhs) |
static int | GetEnabledEncryptionAlgorithms () |
static void | SetEnabledEncryptionAlgorithms (int nEncryptionAlgorithms) |
static bool | IsEncryptionEnabled (EPdfEncryptAlgorithm eAlgorithm) |
static PdfString | GetMD5String (const unsigned char *pBuffer, int nLength) |
![]() | |
void | PadPassword (const std::string &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 std::string &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, pdf_long textlen, unsigned char *textout) |
RC4 encryption. More... | |
void | GenerateInitialVector (unsigned char iv[16]) |
Generate initial vector. | |
void | CreateObjKey (unsigned char objkey[16], int *pnKeyLen) const |
![]() | |
static void | GetMD5Binary (const unsigned char *data, int length, unsigned char *digest) |
Calculate the binary MD5 message digest of the given data. | |
![]() | |
EPdfEncryptAlgorithm | m_eAlgorithm |
The used encryption algorithm. | |
int | m_keyLength |
Length of encryption key. | |
int | m_rValue |
Revision. | |
int | m_pValue |
P entry in pdf document. | |
EPdfKeyLength | m_eKeyLength |
The key length. | |
std::string | m_userPass |
User password. | |
std::string | m_ownerPass |
Owner password. | |
unsigned char | m_rc4key [16] |
last RC4 key | |
unsigned char | m_rc4last [256] |
last RC4 state table | |
unsigned char | m_uValue [32] |
U entry in pdf document. | |
unsigned char | m_oValue [32] |
O entry in pdf document. | |
A class that is used to encrypt a PDF file (RC4 40-bit and 128-bit)
Client code is working only with PdfEncrypt class and knows nothing about PdfEncryptRC4, it is created through CreatePdfEncrypt factory method
|
virtual |
Fill all keys into a encryption dictionary. This dictionary is usually added to the PDF files trailer under the /Encryption key.
rDictionary | an empty dictionary which is filled with information about the used encryption algorithm |
Implements PoDoFo::PdfEncrypt.
|
virtual |
Create a PdfInputStream that decrypts all data read from it using the current settings of the PdfEncrypt object.
Warning: Currently only RC4 based encryption is supported using output streams!
pInputStream | the created PdfInputStream reads all decrypted data to this input stream. |
Implements PoDoFo::PdfEncrypt.
|
virtual |
Create a PdfOutputStream that encrypts all data written to it using the current settings of the PdfEncrypt object.
Warning: Currently only RC4 based encryption is supported using output streams!
pOutputStream | the created PdfOutputStream writes all encrypted data to this output stream. |
Implements PoDoFo::PdfEncrypt.