> I would recommend operating with the output of BN_bn2bin, and 
> where you need to go back the other way, converting back to a BIGNUM using

> BN_bin2bn. The output of BN_bn2bin (and input to BN_bin2bn) is a
byte-array 
> (rather than variable-length words) and is always MS byte first. This also

> prevents you getting into trouble from various padding-out issues, 
> trailing zeroes, and other head-scratchers.

Thanks for help, I have another little problem.

If I call 

BN_bn2bin(bn,NULL)

just to get the buffer length, I get an exception.

My intention was:

1) len=BN_bn2bin(bn,NULL);
2) buffer=(unsigned char*)malloc(len);
3) len=BN_bn2bin(bn,buffer);

Is that sequence wrong?

Do I have to calculate myself the size of returned buffer?
Is the buffer allocated from the BN_bn2bin itself? (I don't think, looking
at the prototype)

what's the difference between BN_bn2bin and the BN_bn2mpi ?

thanks in advance
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to