Hi,
I am able to generate key. how to do seed PRNG before generating key?
is it enough to add rand_load_file("dev/random",1024) before generating key?
it would be helpful if u explain with one example?
#include<stdio.h>
#include<openssl/rsa.h>
#include<string.h>
int main()
{
char *plain="Sample text"; //Sample text (plain text) to Encrypt/Decrypt
char *ciphertext;
printf("%s\n",plain);
// Generate RSA key
RSA *rsa1= RSA_generate_key(1024,65537,NULL,NULL);
// RSA_size() will determine how much memory must be allocated for an
if(rsa1==NULL) {
printf("NO RSA!\n\n");
ERR_load_crypto_strings();
ERR_print_errors_fp(stdout);
}
else
{
printf("RSA OK!\n");
}
ciphertext = (char *)malloc(RSA_size(rsa1));
printf("rsa key = %d\n",rsa1);
printf("RSA size = %d\n",RSA_size(rsa1));
RSA_free(rsa1);
}
Thanks
Kris