X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FDecrypt.h;h=52afb2f6036d118c75151e21fc17404f687ff7ab;hb=16a1056ad5c25f12f7c9b291fcc78dd1f594671c;hp=3ea43741dc77c5b698402277d2a46a377dc02bb5;hpb=fc554a43712b76d16b41ec77dd311b4a78b1ef6b;p=swftools.git diff --git a/pdf2swf/xpdf/Decrypt.h b/pdf2swf/xpdf/Decrypt.h index 3ea4374..52afb2f 100644 --- a/pdf2swf/xpdf/Decrypt.h +++ b/pdf2swf/xpdf/Decrypt.h @@ -2,7 +2,7 @@ // // Decrypt.h // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2002 Glyph & Cog, LLC // //======================================================================== @@ -24,7 +24,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 +32,26 @@ 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 *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); + + int objKeyLength; + Guchar objKey[21]; Guchar state[256]; Guchar x, y; };