fixed windows access violation which occurs if one tries to retrieve
[swftools.git] / pdf2swf / xpdf / Decrypt.h
blob52afb2f6036d118c75151e21fc17404f687ff7ab
1 //========================================================================
2 //
3 // Decrypt.h
4 //
5 // Copyright 1996-2002 Glyph & Cog, LLC
6 //
7 //========================================================================
9 #ifndef DECRYPT_H
10 #define DECRYPT_H
12 #ifdef __GNUC__
13 #pragma interface
14 #endif
16 #include "gtypes.h"
17 #include "GString.h"
19 //------------------------------------------------------------------------
20 // Decrypt
21 //------------------------------------------------------------------------
23 class Decrypt {
24 public:
26 // Initialize the decryptor object.
27 Decrypt(Guchar *fileKey, int keyLength, int objNum, int objGen);
29 // Reset decryption.
30 void reset();
32 // Decrypt one byte.
33 Guchar decryptByte(Guchar c);
35 // Generate a file key. The <fileKey> buffer must have space for at
36 // least 16 bytes. Checks <ownerPassword> and then <userPassword>
37 // and returns true if either is correct. Sets <ownerPasswordOk> if
38 // the owner password was correct. Either or both of the passwords
39 // may be NULL, which is treated as an empty string.
40 static GBool makeFileKey(int encVersion, int encRevision, int keyLength,
41 GString *ownerKey, GString *userKey,
42 int permissions, GString *fileID,
43 GString *ownerPassword, GString *userPassword,
44 Guchar *fileKey, GBool *ownerPasswordOk);
46 private:
48 static GBool makeFileKey2(int encVersion, int encRevision, int keyLength,
49 GString *ownerKey, GString *userKey,
50 int permissions, GString *fileID,
51 GString *userPassword, Guchar *fileKey);
53 int objKeyLength;
54 Guchar objKey[21];
55 Guchar state[256];
56 Guchar x, y;
59 #endif