U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » UppHub » Cypher package - An extensible Encryption package
Re: Cypher package - An extensible Encryption package [message #29055 is a reply to message #29034] Sun, 03 October 2010 20:38 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1310
Registered: September 2007
Ultimate Contributor
Interface should be stable enough, also the streaming part is working.

There are 2 functions to define in derived classes :
        // main encoding/decoding function
        // must be redefined on each derived class
        virtual void Cypher(byte const *sourceBuf,  byte *destBuf, size_t bufLen) = 0;
        
        // main key setting function
        // must be redefined on each derived class
        virtual bool CypherKey(byte const *keyBuf, size_t keyLen, byte const *nonce, size_t nonceLen) = 0;


Plus, you must give BlockSize in constructor in case of Block Cyphers like AES.

Streaming is done with << operator (stream in) and >> operator (stream out).
For block cyphers, there's a Flush() function which pads last block with random data and returns size of encoded stream (true size, without padding). When decoding, using SetStreamSize(size) allows the decoder to un-pad the last block and return cleaned stream.

Block mode is fully supported, with checking of block size in case of Block-Cyphers.
Encoding/Decoding in block mode is done by some overloaded operator() which supports String encoding and binary buffer encoding, in place and out of place.

The test app CypherTest now supports both test with block and streaming modes.

Still missing a couple of small stuffs, but it should be stable enough now.

Ciao

Max
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Themes
Next Topic: Scatter: new zoom and scroll mechanism!
Goto Forum:
  


Current Time: Wed Jul 08 14:36:45 GMT+2 2026

Total time taken to generate the page: 0.00563 seconds