Best options for using bulk encryption (AES 128 / 256 CBC) and crossplatform development?
-
Hello everyone,
I am working on my first major cross platform application, and naturally using Qt was a no-brainer.
The application will be an "agent" that will run as a service on windows, linux and mac.
The agent will sit there collecting metrics and running various automated tasks, until the "client" connects to it and gathers the data that the agent collected along with logs, etc etc.I want to make sure the communications between the client and the agent are secure, SSL would be an obvious choice but I would really rather stay away from certificates (additional hassle) and use AES 128 or preferably AES 256...which will also be used for file encryption.
Wondering if anyone has some experience in this area and can point me in the right direction?
I have used Botan (my video on the subject http://youtu.be/EIcysZtl8AE) for simple applications, but have read about OpenSSL with the "Qt Cryptographic Architecture" (http://delta.affinix.com/qca/), wondering if anyone knows the pros and cons of each? Are there better options?
Basically I am looking for something with a small learning curve that runs anywhere Qt runs, and does not have a huge footprint.
ANY advice and guidance will be much appreciated!
Bryan
-
Both are good, but encrypting the data is not enough here I think.
You will need to do key exchange, etc. or security will be seriously flawed (e.g. by having the key shipped in the binary). Yes, that is exactly the the hassle you want to stay away from;-)
-
Hi,
Iam using QCA library to encrypt and decrypt a mp4 file.Below is the code which i used.
But some how my decrypted file is corrupt and VLC cannot play this file.VLC Output
[loas @ 0xb26150c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[loas @ 0xb26150c0] decoding for stream 0 failed
[loas @ 0xb26150c0] Could not find codec parameters (Audio: aac_latm, 0 channels, s16)
[loas @ 0xb26150c0] Estimating duration from bitrate, this may be inaccurateMycode:
@QCA::Initializer init = QCA::Initializer() ;
if(QCA::isSupported("aes128-cbc-pkcs7"))
{
QFile inputFile("/home/Bala/sample.mp4");if (!inputFile.open(QIODevice::ReadOnly))
qDebug() << "problem while reading " ;QByteArray InputFileByteArray = inputFile.readAll(); inputFile.close(); qDebug() << "size of clear file " << InputFileByteArray.size(); QCA::SecureArray inputSA = InputFileByteArray; qDebug() << "size of inputSA" << inputSA.size(); QString ki = "myencryp"; QCA::SymmetricKey key = ki.toAscii(); QCA::InitializationVector iv = ki.toAscii();
QCA::Cipher cipher(QString("aes128"),QCA::Cipher::CBC, QCA::Cipher::DefaultPadding,QCA::Encode,key,iv);
QCA::SecureArray encoded = cipher.process(inputSA);
qDebug() << "size of encoded" << encoded.size();
if (!cipher.ok()) {
printf("update failed\n");
}
cipher.setup(QCA::Decode, key, iv);
QCA::SecureArray original = cipher.process(encoded);
qDebug() << "size of original" << original.size();
if (!cipher.ok()) {
printf("Final failed\n");
}QByteArray originaldata = original.toByteArray();
qDebug() << "size of originaldata" << originaldata.size();
QFile file1("/home/Bala/sample_decoded.mp4");
if (!file1.open(QIODevice::WriteOnly))
qDebug() << "problem while writing ";
QDataStream out1(&file1);
out1<< originaldata;
file1.close();}@
Please let me know if there are any issues with my code.
-
belagopal: Please do not hijack other people's threads!