1 --- misc/xpdf-3.02/xpdf/SecurityHandler.cc 2007-02-27 23:05:52.000000000 +0100
2 +++ misc/build/xpdf-3.02/xpdf/SecurityHandler.cc 2011-02-03 16:41:49.000000000 +0100
5 encryptDictA->dictLookup("Filter", &filterObj);
6 if (filterObj.isName("Standard")) {
7 - secHdlr = new StandardSecurityHandler(docA, encryptDictA);
8 + secHdlr = new OOoImportSecurityhandler(docA, encryptDictA);
9 } else if (filterObj.isName()) {
11 if ((xsh = globalParams->getSecurityHandler(filterObj.getName()))) {
16 +//------------------------------------------------------------------------
17 +// OOoImportSecurityhandler
18 +//------------------------------------------------------------------------
20 +OOoImportSecurityhandler::~OOoImportSecurityhandler()
24 +inline Guchar toNum( Guchar digit )
26 + return (digit >= '0') && digit <= '9'
28 + : (digit >= 'A' && digit <= 'F')
30 + : (digit >= 'a' && digit <= 'f')
35 +GBool OOoImportSecurityhandler::authorize(void* authData)
41 + GString* ownerPassword = ((StandardAuthData *)authData)->ownerPassword;
44 + const char* pStr = ownerPassword->getCString();
45 + if( strncmp( pStr, "_OOO_pdfi_Credentials_", 22 ) == 0 )
47 + // a hex encoded byte sequence should follow until end of string
48 + // the length must match fileKeyLength
49 + // if this is the case we can assume that the password checked out
50 + // and the file key is valid
51 + // max len is 16 (the size of the fileKey array)
54 + while( pStr[0] && pStr[1] && i < sizeof( fileKey ) )
56 + fileKey[i++] = (toNum( *pStr++ ) << 4)
57 + | (toNum( *pStr++ ));
59 + if( i == size_t(fileKeyLength) )
61 + ownerPasswordOk = gTrue;
67 + return StandardSecurityHandler::authorize( authData );
72 //------------------------------------------------------------------------
73 --- misc/xpdf-3.02/xpdf/SecurityHandler.h 2007-02-27 23:05:52.000000000 +0100
74 +++ misc/build/xpdf-3.02/xpdf/SecurityHandler.h 2011-02-03 16:26:17.000000000 +0100
76 virtual int getEncVersion() { return encVersion; }
77 virtual CryptAlgorithm getEncAlgorithm() { return encAlgorithm; }
83 GBool ownerPasswordOk;
88 +class OOoImportSecurityhandler : public StandardSecurityHandler
91 + OOoImportSecurityhandler( PDFDoc* docA, Object* encryptDictA )
92 + : StandardSecurityHandler( docA, encryptDictA )
94 + virtual ~OOoImportSecurityhandler();
96 + virtual GBool authorize(void* authData);
100 //------------------------------------------------------------------------
101 // ExternalSecurityHandler