upgrade to xpdf 3.00.
[swftools.git] / pdf2swf / xpdf / Decrypt.h
blob71f94574871bc422776c8b33a04ec4b4e6ff61c9
1 //========================================================================
2 //
3 // Decrypt.h
4 //
5 // Copyright 1996-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
9 #ifndef DECRYPT_H
10 #define DECRYPT_H
12 #include <aconf.h>
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
18 #include "gtypes.h"
19 #include "GString.h"
21 //------------------------------------------------------------------------
22 // Decrypt
23 //------------------------------------------------------------------------
25 class Decrypt {
26 public:
28 // Initialize the decryptor object.
29 Decrypt(Guchar *fileKey, int keyLength, int objNum, int objGen);
31 // Reset decryption.
32 void reset();
34 // Decrypt one byte.
35 Guchar decryptByte(Guchar c);
37 // Generate a file key. The <fileKey> buffer must have space for at
38 // least 16 bytes. Checks <ownerPassword> and then <userPassword>
39 // and returns true if either is correct. Sets <ownerPasswordOk> if
40 // the owner password was correct. Either or both of the passwords
41 // may be NULL, which is treated as an empty string.
42 static GBool makeFileKey(int encVersion, int encRevision, int keyLength,
43 GString *ownerKey, GString *userKey,
44 int permissions, GString *fileID,
45 GString *ownerPassword, GString *userPassword,
46 Guchar *fileKey, GBool *ownerPasswordOk);
48 private:
50 static GBool makeFileKey2(int encVersion, int encRevision, int keyLength,
51 GString *ownerKey, GString *userKey,
52 int permissions, GString *fileID,
53 GString *userPassword, Guchar *fileKey);
55 int objKeyLength;
56 Guchar objKey[21];
57 Guchar state[256];
58 Guchar x, y;
61 #endif