1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
/***************************************************************************
* Copyright (C) 2008 by Dominik Seichter *
* domseichter@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _ENCRYPT_TEST_H_
#define _ENCRYPT_TEST_H_
#include <cppunit/extensions/HelperMacros.h>
namespace PoDoFo {
class PdfEncrypt;
}
/** This test tests the class PdfString
*/
class EncryptTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( EncryptTest );
CPPUNIT_TEST( testDefault );
CPPUNIT_TEST( testRC4 );
CPPUNIT_TEST( testRC4v2_40 );
CPPUNIT_TEST( testRC4v2_56 );
CPPUNIT_TEST( testRC4v2_80 );
CPPUNIT_TEST( testRC4v2_96 );
CPPUNIT_TEST( testRC4v2_128 );
CPPUNIT_TEST( testAES );
CPPUNIT_TEST( testLoadEncrypedFilePdfParser );
CPPUNIT_TEST( testLoadEncrypedFilePdfMemDocument );
CPPUNIT_TEST( testEnableAlgorithms );
CPPUNIT_TEST_SUITE_END();
public:
void setUp();
void tearDown();
void testDefault();
void testRC4();
void testRC4v2_40();
void testRC4v2_56();
void testRC4v2_80();
void testRC4v2_96();
void testRC4v2_128();
void testAES();
void testLoadEncrypedFilePdfParser();
void testLoadEncrypedFilePdfMemDocument();
void testEnableAlgorithms();
private:
void TestAuthenticate( PoDoFo::PdfEncrypt* pEncrypt, int keyLength, int rValue );
void TestEncrypt( PoDoFo::PdfEncrypt* pEncrypt );
/**
* Create an encrypted PDF.
*
* @param pszFilename save the encrypted PDF here.
*/
void CreatedEncrypedPdf( const char* pszFilename );
private:
char* m_pEncBuffer;
long m_lLen;
int m_protection;
};
#endif // _ENCRYPT_TEST_H_
|