HI.,
You can use /dev/random as a seed generator..I belive that cygwin
has the support for /dev/random device..
For that u can use RAND_load_file("/dev/random", no_of_bytes) for
programming the seed.
or
otherwise you can use the static character buffer (rnd_seed)as a seed and
use
RAND_seed(rnd_seed, sizeof rnd_seed); to program the seed. In the
second case you need to store the seed such a way hackers should not break the
seed..
Hope
this helps..
Sakthi
S G
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe smith
Sent: Tuesday, August 10, 2004 3:21 AM
To: [EMAIL PROTECTED]
Subject: Random number seed in RSAHi,I have a snippet that encrypts/decrypts using RSA.#include <stdio.h>
#include <openssl/rsa.h>
#include <string.h>
// RSATest: Program illustrating Simple RSA Encryption/Decryption
int main()
{
char *plain="Sample text"; //Sample text (plain text) to Encrypt/Decrypt
char *ciphertext;
char *plain1;
int enclen,i,declen;
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 RSA encrypted value
ciphertext = (char *)malloc(RSA_size(rsa1));
printf("RSA size %d",RSA_size(rsa1));
I am using Cygwin. My question is this....Where and How do I seed the random number generator?
Thanks,
Joe
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. |