Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Decrypt.h

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

Generated on Wed Nov 3 12:58:53 2004 for Lemur Toolkit by doxygen1.2.18