Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Decrypt.h

Go to the documentation of this file.
00001 //========================================================================
00002 //
00003 // Decrypt.h
00004 //
00005 // Copyright 1996-2002 Glyph & Cog, LLC
00006 //
00007 //========================================================================
00008 
00009 #ifndef DECRYPT_H
00010 #define DECRYPT_H
00011 
00012 #ifdef __GNUC__
00013 #pragma interface
00014 #endif
00015 
00016 #include "gtypes.h"
00017 #include "GString.h"
00018 
00019 //------------------------------------------------------------------------
00020 // Decrypt
00021 //------------------------------------------------------------------------
00022 
00023 class Decrypt {
00024 public:
00025 
00026   // Initialize the decryptor object.
00027   Decrypt(Guchar *fileKey, int keyLength, int objNum, int objGen);
00028 
00029   // Reset decryption.
00030   void reset();
00031 
00032   // Decrypt one byte.
00033   Guchar decryptByte(Guchar c);
00034 
00035   // Generate a file key.  The <fileKey> buffer must have space for at
00036   // least 16 bytes.  Checks <ownerPassword> and then <userPassword>
00037   // and returns true if either is correct.  Sets <ownerPasswordOk> if
00038   // the owner password was correct.  Either or both of the passwords
00039   // may be NULL, which is treated as an empty string.
00040   static GBool makeFileKey(int encVersion, int encRevision, int keyLength,
00041                            GString *ownerKey, GString *userKey,
00042                            int permissions, GString *fileID,
00043                            GString *ownerPassword, GString *userPassword,
00044                            Guchar *fileKey, GBool *ownerPasswordOk);
00045 
00046 private:
00047 
00048   static GBool makeFileKey2(int encVersion, int encRevision, int keyLength,
00049                             GString *ownerKey, GString *userKey,
00050                             int permissions, GString *fileID,
00051                             GString *userPassword, Guchar *fileKey);
00052 
00053   int objKeyLength;
00054   Guchar objKey[21];
00055   Guchar state[256];
00056   Guchar x, y;
00057 };
00058 
00059 #endif

Generated on Sat Nov 5 16:18:13 2005 for OPIE by  doxygen 1.4.2