Originally Posted by
wysota
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
int MAX_BLK_SIZE = 64;
string sSrcBlk = dat;
int hManyBlks = sSrcBlk.length()/MAX_BLK_SIZE;
char** pSrcBlk = new char*[hManyBlks + 1];
for( int i=0; i < hManyBlks; ++i )
{
pSrcBlk[i] = new char[MAX_BLK_SIZE + 1];
memcpy(pSrcBlk[i], sSrcBlk.data(), MAX_BLK_SIZE);
}
//append the block
for( int i=0; i < hManyBlks; ++i )
//send blks through mail stream adding base64 header
int MAX_BLK_SIZE = 64;
string sSrcBlk = dat;
int hManyBlks = sSrcBlk.length()/MAX_BLK_SIZE;
char** pSrcBlk = new char*[hManyBlks + 1];
for( int i=0; i < hManyBlks; ++i )
{
pSrcBlk[i] = new char[MAX_BLK_SIZE + 1];
memcpy(pSrcBlk[i], sSrcBlk.data(), MAX_BLK_SIZE);
}
//append the block
for( int i=0; i < hManyBlks; ++i )
QString blks = QString( pSrcBlk[i] ) + QString("\r\n");
//send blks through mail stream adding base64 header
To copy to clipboard, switch view to plain text mode
while receiving
1) parse -- How to do this ?
2) contcatenate lines -- How to do this ?
3) base64 decode into ByteArray -- I can do it
4) decrypt ---- I can do it
5) pass the result into the stream -- I can do it
1) parse -- How to do this ?
2) contcatenate lines -- How to do this ?
3) base64 decode into ByteArray -- I can do it
4) decrypt ---- I can do it
5) pass the result into the stream -- I can do it
To copy to clipboard, switch view to plain text mode
Bookmarks