Initial revision
[swftools.git] / pdf2swf / xpdf / Decrypt.h
1 //========================================================================
2 //
3 // Decrypt.h
4 //
5 // Copyright 1996 Derek B. Noonburg
6 //
7 //========================================================================
8
9 #ifndef DECRYPT_H
10 #define DECRYPT_H
11
12 #ifdef __GNUC__
13 #pragma interface
14 #endif
15
16 #include "gtypes.h"
17 #include "GString.h"
18
19 //------------------------------------------------------------------------
20 // Decrypt
21 //------------------------------------------------------------------------
22
23 class Decrypt {
24 public:
25
26   // Initialize the decryptor object.
27   Decrypt(Guchar *fileKey, int objNum, int objGen);
28
29   // Reset decryption.
30   void reset();
31
32   // Decrypt one byte.
33   Guchar decryptByte(Guchar c);
34
35   // Generate a file key.  The <fileKey> buffer must have space for
36   // at least 16 bytes.  Checks user key and returns gTrue if okay.
37   // <userPassword> may be NULL.
38   static GBool makeFileKey(GString *ownerKey, GString *userKey,
39                            int permissions, GString *fileID,
40                            GString *userPassword, Guchar *fileKey);
41
42 private:
43
44   Guchar objKey[16];
45   Guchar state[256];
46   Guchar x, y;
47 };
48
49 #endif