X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FDecrypt.h;h=2beba581583e6dca87e1d34ce40cc9ff85896700;hb=8e19aa73faaa2990c0bec79ed45d38ef343c0a67;hp=3ea43741dc77c5b698402277d2a46a377dc02bb5;hpb=fc554a43712b76d16b41ec77dd311b4a78b1ef6b;p=swftools.git diff --git a/pdf2swf/xpdf/Decrypt.h b/pdf2swf/xpdf/Decrypt.h index 3ea4374..2beba58 100644 --- a/pdf2swf/xpdf/Decrypt.h +++ b/pdf2swf/xpdf/Decrypt.h @@ -2,14 +2,16 @@ // // Decrypt.h // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== #ifndef DECRYPT_H #define DECRYPT_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -24,7 +26,7 @@ class Decrypt { public: // Initialize the decryptor object. - Decrypt(Guchar *fileKey, int objNum, int objGen); + Decrypt(Guchar *fileKey, int keyLength, int objNum, int objGen); // Reset decryption. void reset(); @@ -32,16 +34,28 @@ public: // Decrypt one byte. Guchar decryptByte(Guchar c); - // Generate a file key. The buffer must have space for - // at least 16 bytes. Checks user key and returns gTrue if okay. - // may be NULL. - static GBool makeFileKey(GString *ownerKey, GString *userKey, + // Generate a file key. The buffer must have space for at + // least 16 bytes. Checks and then + // and returns true if either is correct. Sets if + // the owner password was correct. Either or both of the passwords + // may be NULL, which is treated as an empty string. + static GBool makeFileKey(int encVersion, int encRevision, int keyLength, + GString *ownerKey, GString *userKey, int permissions, GString *fileID, - GString *userPassword, Guchar *fileKey); + GString *ownerPassword, GString *userPassword, + Guchar *fileKey, GBool encryptMetadata, + GBool *ownerPasswordOk); private: - Guchar objKey[16]; + static GBool makeFileKey2(int encVersion, int encRevision, int keyLength, + GString *ownerKey, GString *userKey, + int permissions, GString *fileID, + GString *userPassword, Guchar *fileKey, + GBool encryptMetadata); + + int objKeyLength; + Guchar objKey[21]; Guchar state[256]; Guchar x, y; };