TMessageDigest

TMessageDigest, an abstract base class, captures the common characteristics of all message digest classes. A message digest algorithm is a one-way encryption engine that takes a message of any length and generates a coded pattern that is referred to as the digest of the message. Message digest algorithms are used for electronic signatures as well as concealing information. The TMessageDigest class also allows polymorphism among message digest algorithms which are derived from the TMessageDigest base class. This enables products that use message digests to be coded independently of the "best algorithm of the day" so that new algorithms can be plugged in at any time.

      class TMessageDigest : public MCollectible {
      //    Copyright (C) 1995 Taligent, Inc. All rights reserved.
      public:
          //.................................................................
          //  destructor
          virtual         ~TMessageDigest();
          
          //.................................................................
          //  MCollectible overrides.
          TStream&        operator>>=   (TStream& toWhere) const;
          TStream&        operator<<=     (TStream& fromWhere);
          
          //.................................................................
          //  TMessageDigest specific operations.
          virtual void    GetDigestType   (TText& type) const= 0;
          virtual void    GetMessageDigest(TPrimitiveTypeArray <unsigned char>& array) const;
      
      protected:
      };

Instantiation

TMessageDigest is an abstract base class and cannot be instantiated.

Member functions

GetDigestType is a pure virtual function that needs to be implemented in all derived classes.

GetMessageDigest returns the array of unsigned characters that contains the message digest. The message digest is set by the derived class algorithm when the encryption is complete. If the digest has not yet been set, TPrimitiveTypeArray contains zero values.

SetMessageDigest can be used by the derived class algorithm to load the resulting message digest into the TMessageDigest portion of the object.

Deriving classes

A TMessageDigest object can be derived to provide implementations of the various message digest algorithms. For a complete implementation, DigestType must be overridden.

Concurrency

The TMessageDigest class is not designed for concurrent access.

Resource use

No special requirements.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker