PoDoFo  0.9.4
Public Member Functions | List of all members
PoDoFo::PdfEncryptRC4 Class Reference

#include <PdfEncrypt.h>

Inherits PoDoFo::PdfEncryptMD5Base.

Public Member Functions

virtual bool Authenticate (const std::string &password, const PdfString &documentId)
 
virtual void Encrypt (const unsigned char *inStr, pdf_long inLen, unsigned char *outStr, pdf_long outLen) const
 Encrypt a character string.
 
virtual void Decrypt (const unsigned char *inStr, pdf_long inLen, unsigned char *outStr, pdf_long &outLen) const
 Decrypt a character string.
 
virtual PdfInputStreamCreateEncryptionInputStream (PdfInputStream *pInputStream)
 
virtual PdfOutputStreamCreateEncryptionOutputStream (PdfOutputStream *pOutputStream)
 
virtual void GenerateEncryptionKey (const PdfString &documentId)
 
virtual pdf_long CalculateStreamOffset () const
 Calculate stream offset.
 
virtual pdf_long CalculateStreamLength (pdf_long length) const
 Calculate stream size.
 

Detailed Description

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

Member Function Documentation

virtual bool PoDoFo::PdfEncryptRC4::Authenticate ( const std::string &  password,
const PdfString documentId 
)
virtual

Tries to authenticate a user using either the user or owner password

Parameters
passwordowner or user password
documentIdthe documentId of the PDF file
Returns
true if either the owner or user password matches password

Implements PoDoFo::PdfEncrypt.

virtual PdfInputStream* PoDoFo::PdfEncryptRC4::CreateEncryptionInputStream ( PdfInputStream pInputStream)
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!

Parameters
pInputStreamthe created PdfInputStream reads all decrypted data to this input stream.
Returns
a PdfInputStream that decrypts all data.

Implements PoDoFo::PdfEncrypt.

virtual PdfOutputStream* PoDoFo::PdfEncryptRC4::CreateEncryptionOutputStream ( PdfOutputStream pOutputStream)
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!

Parameters
pOutputStreamthe created PdfOutputStream writes all encrypted data to this output stream.
Returns
a PdfOutputStream that encryts all data.

Implements PoDoFo::PdfEncrypt.

virtual void PoDoFo::PdfEncryptRC4::GenerateEncryptionKey ( const PdfString documentId)
virtual

Generate encryption key from user and owner passwords and protection key

Parameters
documentIdthe documentId of the current document

Implements PoDoFo::PdfEncrypt.