author | sandman <sandman> | 2002-04-13 00:47:20 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-04-13 00:47:20 (UTC) |
commit | 98a1e3f36567639344f12932b629e526a8783aa8 (patch) (unidiff) | |
tree | 0433d296857faceeafc54f7deabddb621f45a933 /noncore/unsupported/qpdf/xpdf/Decrypt.h | |
parent | 7e31b1fba119f69929d6744d7295555ff1727f4f (diff) | |
download | opie-98a1e3f36567639344f12932b629e526a8783aa8.zip opie-98a1e3f36567639344f12932b629e526a8783aa8.tar.gz opie-98a1e3f36567639344f12932b629e526a8783aa8.tar.bz2 |
CVS import of QPdf
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/Decrypt.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/Decrypt.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Decrypt.h b/noncore/unsupported/qpdf/xpdf/Decrypt.h new file mode 100644 index 0000000..1bdb2b7 --- a/dev/null +++ b/noncore/unsupported/qpdf/xpdf/Decrypt.h | |||
@@ -0,0 +1,59 @@ | |||
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 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 | GString *ownerKey, GString *userKey, | ||
42 | int permissions, GString *fileID, | ||
43 | GString *ownerPassword, GString *userPassword, | ||
44 | Guchar *fileKey, GBool *ownerPasswordOk); | ||
45 | |||
46 | private: | ||
47 | |||
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); | ||
52 | |||
53 | int objKeyLength; | ||
54 | Guchar objKey[21]; | ||
55 | Guchar state[256]; | ||
56 | Guchar x, y; | ||
57 | }; | ||
58 | |||
59 | #endif | ||