[EMAIL PROTECTED] wrote:
>
> Hi friends,
>
> RSA_check_key() cores.
RSA_check_key() expects a private key => the RSA structure
must contain valid rsa->p and rsa->q entries otherwise
RSA_check_key() will always produce a core dump
( without p and q you can not verify that a RSA key is valid,
but of course it would be better if RSA_check_key() returns
a error message instead of a core :) .
> The following is what I did ...
[...]
> RSA_Keys->n=BN_new();
> BN_init(RSA_Keys->n);
BN_init() is unnecessary, because BN_new() initialize
the BIGNUM structure.
[...]
> else if( !(RSA_Keys->n->d = (BN_ULONG *)malloc((ModBinLen+1)
> *BN_BITS2))) {
> printf("RSA_Keys->n->d is NULL\n");
> exit(1);
> }
1. use OPENSSL_malloc()
2. set the BIGNUM->dmax value to ModBinLen+1
3. 1. and 2. are unnecessary because the BN functions automatically
allocate the required memory.
[...]
>
> what am I doing wrong that is causing this problem. Basically what I am
> trying in this program is
> to create a RSA structure using the public key modulus and exponent in
> Base64 format.
>
> Any help would be greatly appreciated.
>
> Also is there any function that does this for me in OPENSSL?
AFAIK there are only functions to read/write a PEM encoded
PKCS#1 RSA public key (PEM_[read|write]_bio_RSAPublicKey).
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]