ScrambleCoder
Password-based encryption coder class
[Previous] [Main] [Next]


Description
ScrambleCoder is a Coder-derived class that performs password-based encryption of data using a relatively complex (non-DES) but efficient algorithm. This algorithm is appropriate for applications that require moderate to advanced security. Though a proprietary algorithm is used, the level of security is comparable to that offered by stand-alone utilities such as PKWare's PKZip. If your application requires extremely tight security, you may wish to create your own Coder-derived class that implements DES, RSA, or another algorithm.  
 
ScrambleCoder encodes a two-byte checksum, encrypted along with the input data, to its output. For this reason, the length reference parameter returned by the Encode() method will be larger than the original value. During decryption, the encoded checksum is decrytped and compared to the checksum of the rest of the output to determine whether the correct password was supplied. If the checksums don't match, or if an error occurs, ScrambleCoder::Decode() sets its length reference return parameter to zero to indicate the condition.  
 
To use ScrambleCoder for automatic encryption and decryption of name/value pairs in URL's and hidden form fields, simply instantiate a ScrambleCoder object, supplying the password in the constructor, then pass a reference to the object to your application's htmlServer object using htmlServer::Crypt().  
 
Declaration
#include <dcmicro/htmlpp/coder.h>  
 
Hierarchy
scramblecoder.gif  
 
See Also
htmlServer, Coder  
 
Related Constants/Definitions
None.  
 
Constructors
Destructors
Member Methods
Refer to the documentation for the Coder class.  
 
Example Use
 
#include <stdio.h>  
#include <stdlib.h>  
#include <dcmicro/htmlpp/htmlpp.h>  
 
int main( void )  
{  
   //  Instantiate a ScrambleCoder object with our  
   //  password, then inform the server object. Note  
   //  that this is performed BEFORE the server object  
   //  is initialized.  
   ScrambleCoder  scramble( "password" ) ;  
 
   htmlCgi    server ;  
   server.Crypt( &scramble ) ;  
   server.Initialize( cin ) ;  
 
   htmlPage   page( "html++ example application" ) ;  
 
   //  From the application's perspective, any name/value  
   //  pairs loaded from the server are already decrypted.  
   //  Data encoded using the htmlCgi::AsURL() method will  
   //  be automatically encrypted when that method is called.  
   //  Other data will be encrypted during final output.  
 
   //  ... continue with application here ...  
 
   //  Any hidden form fields will be automatically  
   //  encrypted during output.  
   server << page ;  
   return 0 ;  
}  
 


©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.