Results 1 to 20 of 21

Thread: sending encrypted data via mail using smtp

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    Join Date
    Sep 2006
    Posts
    339
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    15
    Thanked 21 Times in 16 Posts

    Default Re: sending encrypted data via mail using smtp

    Quote Originally Posted by wysota View Post
    The order while sending should be:
    1. encrypt file
    2. encode it with base64
    3. divide it into blocks 64 (or 80 or whatever) bytes each
    4. concatenate blocks using newlines (\r\n)
    5. pass the result into the mail stream adding a base64 header

    when receiving a mail:
    1. parse headers
    2. concatenate lines
    3. base64 decode into QByteArray
    4. decrypt
    5. pass the result into the stream
    Did you mean this below code

    while sending
    Qt Code:
    1. int MAX_BLK_SIZE = 64;
    2. string sSrcBlk = dat;
    3. int hManyBlks = sSrcBlk.length()/MAX_BLK_SIZE;
    4. char** pSrcBlk = new char*[hManyBlks + 1];
    5.  
    6. for( int i=0; i < hManyBlks; ++i )
    7. {
    8. pSrcBlk[i] = new char[MAX_BLK_SIZE + 1];
    9. memcpy(pSrcBlk[i], sSrcBlk.data(), MAX_BLK_SIZE);
    10. }
    11.  
    12. //append the block
    13. for( int i=0; i < hManyBlks; ++i )
    14. QString blks = QString( pSrcBlk[i] ) + QString("\r\n");
    15.  
    16. //send blks through mail stream adding base64 header
    To copy to clipboard, switch view to plain text mode 

    while receiving
    Qt Code:
    1. 1) parse -- How to do this ?
    2. 2) contcatenate lines -- How to do this ?
    3. 3) base64 decode into ByteArray -- I can do it
    4. 4) decrypt ---- I can do it
    5. 5) pass the result into the stream -- I can do it
    To copy to clipboard, switch view to plain text mode 
    Last edited by vermarajeev; 13th August 2007 at 15:30.

Similar Threads

  1. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 09:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.