home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 720 / PDF090B4-SorceCode / pdf / Decrypt.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-27  |  1.2 KB  |  53 lines

  1. //========================================================================
  2. //
  3. // Decrypt.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8. //
  9. // Ported to EPOC by Sander van der Wal
  10.  
  11. #ifndef DECRYPT_H
  12. #define DECRYPT_H
  13.  
  14. #ifdef __GNUC__
  15. #pragma interface
  16. #endif
  17.  
  18. #include "gtypes.h"
  19. #include "GString.h"
  20.  
  21.  
  22. //------------------------------------------------------------------------
  23. // Decrypt
  24. //------------------------------------------------------------------------
  25.  
  26. class Decrypt {
  27. public:
  28.  
  29.   // Initialize the decryptor object.
  30.   Decrypt(Guchar *fileKey, 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
  39.   // at least 16 bytes.  Checks user key and returns gTrue if okay.
  40.   // <userPassword> may be NULL.
  41.   static GBool makeFileKeyL(GString *ownerKey, GString *userKey,
  42.                 int permissions, GString *fileID,
  43.                 GString *userPassword, Guchar *fileKey);
  44.  
  45. private:
  46.  
  47.   Guchar objKey[16];
  48.   Guchar state[256];
  49.   Guchar x, y;
  50. };
  51.  
  52. #endif
  53.