Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Cypher package - An extensible Encryption package
Cypher package - An extensible Encryption package [message #29034] Sun, 03 October 2010 01:42 Go to next message
mdelfede is currently offline  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 Go to previous messageGo to next message
mdelfede is currently offline  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
Re: Cypher package - An extensible Encryption package [message #29102 is a reply to message #29055] Tue, 05 October 2010 09:00 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Thanks! I'll look at it today and write ASAP.
Re: Cypher package - An extensible Encryption package [message #29109 is a reply to message #29102] Tue, 05 October 2010 14:20 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
I guess I need to add an option to have embedded in encoded stream both the IV and the data size.... Not too difficult indeed.
I'll wait for your feedback before.

Max
Re: Cypher package - An extensible Encryption package [message #29111 is a reply to message #29109] Tue, 05 October 2010 16:28 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello all

It would be great if Cypher package would include SHA2 functions, like in AESStream, but not depending on OpenSSL.

If you do not know where to get a BSD or better licensed implementation I would do it.


Best regards
Iñaki
Re: Cypher package - An extensible Encryption package [message #29114 is a reply to message #29111] Tue, 05 October 2010 22:02 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
koldo wrote on Tue, 05 October 2010 16:28

Hello all

It would be great if Cypher package would include SHA2 functions, like in AESStream, but not depending on OpenSSL.

If you do not know where to get a BSD or better licensed implementation I would do it.


Hi Koldo,

If you find some source about it, I'll be glad to add to cypher package.
I agree with you that we should avoid external dependencies at most.

Ciao

Max
Re: Cypher package - An extensible Encryption package [message #29120 is a reply to message #29114] Wed, 06 October 2010 09:00 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Massimo and Mindtraveller

A possible source is Crypto++ (http://www.cryptopp.com/ http://en.wikipedia.org/wiki/Crypto%2B%2B).

It is one of the fastest as includes a lot of assembler (for gcc and msvc) and AES-NI, FIPS compliant and using parts of it, it is public domain.


Best regards
Iñaki
Re: Cypher package - An extensible Encryption package [message #29196 is a reply to message #29120] Sun, 10 October 2010 00:14 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Small change in interface : now base class is Cypher and not CypherBase.
That was needed to make more intuitive the usage of generic Cypher pointers.

Because of that change, virtual function Cypher() (the one that must be redefined in derived classes) now names CypherCypher.

Max
Re: Cypher package - An extensible Encryption package [message #29316 is a reply to message #29196] Fri, 15 October 2010 12:12 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello

Anything about Crypto++?.

May I submit SHA-2 code based on it?


Best regards
Iñaki
Re: Cypher package - An extensible Encryption package [message #29317 is a reply to message #29316] Fri, 15 October 2010 12:16 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
koldo wrote on Fri, 15 October 2010 12:12

Hello

Anything about Crypto++?.

May I submit SHA-2 code based on it?


Yes, with pleasure Smile
I've no time to do it right now, if you like to do I'll be happy.
But please, please.... comment it the most you can ! Smile

Ciao

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


Current Time: Thu Mar 28 17:44:01 CET 2024

Total time taken to generate the page: 0.01140 seconds