source: trunk/poppler/mypoppler/poppler/Decrypt.h @ 2

Last change on this file since 2 was 2, checked in by Eugene Romanenko, 16 years ago

First import

File size: 1.7 KB
Line 
1//========================================================================
2//
3// Decrypt.h
4//
5// Copyright 1996-2003 Glyph & Cog, LLC
6//
7//========================================================================
8
9#ifndef DECRYPT_H
10#define DECRYPT_H
11
12#ifdef USE_GCC_PRAGMAS
13#pragma interface
14#endif
15
16#include "goo/gtypes.h"
17#include "goo/GooString.h"
18
19//------------------------------------------------------------------------
20// Decrypt
21//------------------------------------------------------------------------
22
23class Decrypt {
24public:
25
26  // Initialize the decryptor object.
27  Decrypt(Guchar *fileKey, int keyLength, 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 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                           GooString *ownerKey, GooString *userKey,
42                           int permissions, GooString *fileID,
43                           GooString *ownerPassword, GooString *userPassword,
44                           Guchar *fileKey, GBool encryptMetadata,
45                           GBool *ownerPasswordOk);
46
47private:
48
49  static GBool makeFileKey2(int encVersion, int encRevision, int keyLength,
50                            GooString *ownerKey, GooString *userKey,
51                            int permissions, GooString *fileID,
52                            GooString *userPassword, Guchar *fileKey,
53                            GBool encryptMetadata);
54
55  int objKeyLength;
56  Guchar objKey[21];
57  Guchar state[256];
58  Guchar x, y;
59};
60
61#endif
Note: See TracBrowser for help on using the repository browser.