PDA

View Full Version : Encryption, approach request



unix7777
20th February 2010, 11:18
i'm tying to make text redactor with ability to encrypt the text using for example AES128,256.
I read that QtCrypto a 3rd party library is used to implement such algorithm.
Are there any alternatives ?
Any recommendations?

wysota
20th February 2010, 15:28
I would use libcrypto (from OpenSSL) directly especially that Qt uses it itself for SSL functionality. It's C-based but you just need a few calls to be able to use it so it's painless. I even wrote a Qt wrapper around it some time ago.

unix7777
20th February 2010, 15:41
OpenSSL is used for network transfer encryption.What i need is completely different.i need to encrypt a plain text using AES256 algorithm

Lykurg
20th February 2010, 16:19
Let me ask you a question: A pencil is made to write with it on papers. But could you also write with it on a wall? YES. On the floor? YES. On your pants? YES. And this although it wasn't designed for that!

And now, can you imagine, that you can use a library, which was constructed to encrypt text for sending it over the network, only local?:D

wysota
20th February 2010, 16:24
OpenSSL is used for network transfer encryption.What i need is completely different.i need to encrypt a plain text using AES256 algorithm

libcrypto is a cryptographic library. Period.

BTW. Pencils don't really write on pants and they are quite lousy when writing on walls too. libcrypto is much better in doing AES encryption ;)

A snippet of code from my libcrypto wrapper:


QByteArray result = device.readAll(); // some encrypted data
QwwCipher ciph("aes-128-cbc");
ciph.setKey("0123456789ABCDEF");
ciph.setIv(QByteArray(16,0));
ciph.setInput(&result);
QFile f("/tmp/tst.txt");
ciph.setOutput(&f);
ciph.decryptAll();

BTW 2. libcrypto is doing all the PKI for SSL/TLS so it's definitely not only about transfering data over network (which it doesn't do) - something has to generate, sign and verify SSL keys and certificates, right?

pitonyak
22nd February 2010, 15:19
Here is another very brief link (http://saju.net.in/blog/?p=36), which explains why he created this example (http://saju.net.in/code/misc/openssl_aes.c.txt).