October 15, 2011

rootshell rootshell
Lab Rat
32 posts

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

 Signature 

Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

Languages: C++, C#, VB, Python, Java

4 replies

October 15, 2011

Tobias Hunger Tobias Hunger
Hobby Entomologist
3373 posts

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;-)

October 17, 2011

rootshell rootshell
Lab Rat
32 posts

I hear you :)

Any pointers or direction on getting started with OpenSSL?

 Signature 

Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

Languages: C++, C#, VB, Python, Java

September 22, 2012

balagopal balagopal
Lab Rat
2 posts

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

  1.  0xb26150c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
  2. [loas
0xb26150c0] decoding for stream 0 failed
[loas
  1.  0xb26150c0] Could not find codec parameters (Audio: aac_latm, 0 channels, s16)
  2. [loas
0xb26150c0] Estimating duration from bitrate, this may be inaccurate

Mycode:

  1. QCA::Initializer init = QCA::Initializer() ;
  2.  if(QCA::isSupported("aes128-cbc-pkcs7"))
  3. {
  4. QFile inputFile("/home/Bala/sample.mp4");
  5.  
  6.  if (!inputFile.open(QIODevice::ReadOnly))
  7.      qDebug() << "problem while reading " ;
  8.  
  9.      QByteArray InputFileByteArray = inputFile.readAll();
  10.      inputFile.close();
  11.      qDebug() << "size of clear file " << InputFileByteArray.size();
  12.      QCA::SecureArray inputSA = InputFileByteArray;
  13.          qDebug() << "size of inputSA" << inputSA.size();
  14.      QString ki = "myencryp";
  15.      QCA::SymmetricKey key = ki.toAscii();
  16.      QCA::InitializationVector iv = ki.toAscii();
  17.  
  18.  
  19. QCA::Cipher cipher(QString("aes128"),QCA::Cipher::CBC, QCA::Cipher::DefaultPadding,QCA::Encode,key,iv);
  20.  
  21. QCA::SecureArray encoded = cipher.process(inputSA);
  22.     qDebug() << "size of encoded" << encoded.size();
  23.          if (!cipher.ok()) {
  24.                     printf("update failed\n");
  25.              }
  26.    cipher.setup(QCA::Decode, key, iv);
  27. QCA::SecureArray original = cipher.process(encoded);
  28.  qDebug() << "size of original" << original.size();
  29.     if (!cipher.ok()) {
  30.                printf("Final failed\n");
  31.         }
  32.  
  33.     QByteArray originaldata = original.toByteArray();
  34.  qDebug() << "size of originaldata" << originaldata.size();
  35.     QFile file1("/home/Bala/sample_decoded.mp4");
  36.     if (!file1.open(QIODevice::WriteOnly))
  37.             qDebug() << "problem while writing ";
  38.     QDataStream out1(&file1);
  39.     out1<< originaldata;
  40.     file1.close();
  41.  
  42. }

Please let me know if there are any issues with my code.

September 22, 2012

Tobias Hunger Tobias Hunger
Hobby Entomologist
3373 posts

belagopal: Please do not hijack other people’s threads!

 
  ‹‹ column width in QTableWidget      QtHelpEngine not working in deployed application ››

You must log in to post a reply. Not a member yet? Register here!