Rafael Cividanes wrote:
Hi, I've implemented (in C++) a simple form of shamir secret sharing for the particular case (3,5). One function receives a BIGNUM A0 an generates the 5 secrets. Another function, receives 3 secrets and generates the recover BIGNUM A0. It's working fine. The problem is that I need to convert a RSA private key into a BIGNUM A0, and I'm having trouble with this. I was trying to do this (part of my code): RSA *Ch_Ap
        unsigned char *buffer, *next;
        BIGNUM *sec_BN = BN_new();
        Ch_Ap = RSA_generate_key(2048, RSA_F4, NULL, 0);
        int size = i2d_RSAPrivateKey(Ch_Ap, 0);
        buffer = next =(unsigned char *)malloc(size);
        i2d_RSAPrivateKey(Ch_Ap, &next);
BN_bin2bn(buffer, size, sec_BN);

are you sure that you want to put the DER encoded private key
object into a BIGNUM (instead of rsa->d) ?

Cheers,
Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to