~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/xpdflib/decrypt.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2005-02-24 22:09:16 UTC
  • mfrom: (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050224220916-9vxiiqjz066r5489
Tags: 6.0pre23-2
debian/control: Ipe should depend on exact version of libipe.
Closes: #296771.

Show diffs side-by-side

added added

removed removed

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