SHARE
TWEET

Untitled

a guest Mar 22nd, 2013 5 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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!");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top