|
|
Home » Developing U++ » UppHub » Cypher package - An extensible Encryption package
Cypher package - An extensible Encryption package [message #29034] |
Sun, 03 October 2010 01:42 |
mdelfede
Messages: 1307 Registered: September 2007
|
Ultimate Contributor |
|
|
I uploaded the very first implementation of a generic encryption package, as discussed in topic
http://www.ultimatepp.org/forum/index.php?t=msg&th=5568& amp; amp; amp;start=0&
I tried to have an interface as modular as possible in order to be able to merge all current Encryption packages.
It has a base class defining the interface; supports String, Block and Streaming encryption.
By now it implements RC4 and Snow2 Streaming symmetric encryptors.
Other modules should derive from CypherBase class and implement ALL of its pure virtual functions in order to keep the interface identical.
Package still miss error handling, it'll implemented when we'll agree on the interface proposed.
Docs are missing too, for the same reason.
There's also an extensible testing application, which allow to select the encryption module, the encryption mode and some more.
Pavel, could you look if the interface meets your needs too ?
It still miss the Initialization Vector handling, I've got some ideas on how to make it fit yours and my needs, but before implementing it I'd like the interface to be stable enough.
Ciao
Max
EDIT : Please wait to review package... I'm making still many changes in interface and moving most routines to base class.
Max
[Updated on: Sun, 03 October 2010 12:48] Report message to a moderator
|
|
|
Re: Cypher package - An extensible Encryption package [message #29055 is a reply to message #29034] |
Sun, 03 October 2010 20:38 |
mdelfede
Messages: 1307 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
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Apr 19 13:49:53 CEST 2024
Total time taken to generate the page: 0.01444 seconds
|
|
|