You can also use the RAND_status() function that implicitly calls RAND_poll().
RAND_poll() actually uses memory state, processes, handles, screen state... to
initialize the PRNG. If it is not sufficiant (it usually is), you can read some
entropy from a file using RAND_read() function.
Marc.
-Message d'origine-
De : lbfi [mailto:[EMAIL PROTECTED]
Envoyé : mardi 10 août 2004 12:59
À : openssl-users
Objet : Re:Random number seed in RSA
You can use these functions:
void RAND_seed(const void *buf, int num);
void RAND_add(const void *buf, int num, double
entropy);
int RAND_status(void);
int RAND_event(UINT iMsg, WPARAM wParam, LPARAM
lParam);
void RAND_screen(void);
You need to seed PRNG before the function
RSA_generate_key(...). a good explanation you will find
in:
http://www.openssl.org/docs/crypto/RAND_add.html
Hi,
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 thisWhere and
How do I seed the random number generator?
Thanks,
Joe
-
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
Leandro Barros de Figueiredo
Eng. Controle e Automação - UFMG
__
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]