Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2013
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1.     RAND_load_file("/dev/urandom", 1024);
  2.     OpenSSL_add_all_algorithms();
  3.     rsaKey = RSA_generate_key(1024, 65537, NULL, NULL);
  4.     RSA_blinding_on(rsaKey, NULL);
  5.     BIO *bio = BIO_new(BIO_s_mem());
  6.     //Start input thread
  7.     i2d_RSAPublicKey_bio(bio, rsaKey);
  8.  
  9.     BUF_MEM *mem = NULL;
  10.     BIO_get_mem_ptr(bio, &mem);
  11.     BIO_set_close(bio, BIO_NOCLOSE);
  12.     BIO_free(bio);
  13.     char* data = mem->data;
  14.     int length = mem->length;
  15.     ASN1PUBKEY = new QByteArray(data, length);
  16.     ConsoleLogger::fine("RSA key created!");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement