mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-21 23:40:26 -04:00
updated values for min/normal partial packet size to 1MB, so that we do not create partial packets for everyday use. We will have to properly extend openpgp-sdk to support parsing of partial packets if we want to PGP-encrypt chunks larger than 1MB.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6553 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ab68f1d123
commit
c34ede4b1c
5 changed files with 26 additions and 9 deletions
|
@ -299,6 +299,10 @@ int main(int argc,char *argv[])
|
|||
PGPIdType key_id(key_id_string) ;
|
||||
std::string outfile = "crypted_toto.pgp" ;
|
||||
std::string text_to_encrypt = "this is a secret message" ;
|
||||
std::string text = "fhdsjfhskfhdsjhfskhfkdsfskfhsdhdsj" ;
|
||||
|
||||
for(int i=0;i<2;++i)
|
||||
text_to_encrypt += text ;
|
||||
|
||||
std::cerr << "Checking encrypted file creation: streaming chain \"" << text_to_encrypt << "\" to file " << outfile << " with key " << key_id.toStdString() << std::endl;
|
||||
|
||||
|
@ -333,7 +337,7 @@ int main(int argc,char *argv[])
|
|||
if(key_id_string.empty())
|
||||
key_id_string = askForKeyId(pgph) ;
|
||||
|
||||
static const int MEM_TO_ENCRYPT_SIZE = 10000 ;
|
||||
static const int MEM_TO_ENCRYPT_SIZE = 20000 ;
|
||||
|
||||
PGPIdType key_id(key_id_string) ;
|
||||
|
||||
|
@ -353,6 +357,11 @@ int main(int argc,char *argv[])
|
|||
|
||||
CHECK(res) ;
|
||||
|
||||
// dump to a file
|
||||
FILE *f = fopen("crypted_toto.bin","w") ;
|
||||
fwrite(encrypted_mem_block,encrypted_mem_size,1,f) ;
|
||||
fclose(f) ;
|
||||
|
||||
if(!res)
|
||||
std::cerr << "Encryption failed" << std::endl;
|
||||
else
|
||||
|
@ -368,10 +377,10 @@ int main(int argc,char *argv[])
|
|||
|
||||
CHECK(res) ;
|
||||
|
||||
if(!res)
|
||||
std::cerr << "Decryption failed" << std::endl;
|
||||
else
|
||||
if(res && decrypted_mem_size == MEM_TO_ENCRYPT_SIZE)
|
||||
std::cerr << "Decryption success" << std::endl;
|
||||
else
|
||||
std::cerr << "Decryption failed" << std::endl;
|
||||
|
||||
Sha1CheckSum decrypted_sha1 = RsDirUtil::sha1sum(decrypted_mem,decrypted_mem_size) ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue