On 18/11/14 17:04, Indtiny S wrote:
> Hi,
> Thanks for the reply .
> 
> Now below code is working fine. But is there any straight way get the
> public key also?
> 
> void handleErrors(void){
> 
> printf("\n Error ");
> }
> 
> 
> void myPrint( BIGNUM * x, char * t ) {
>    char * s = BN_bn2dec( x ) ;
>    printf("%s%s", s, t ) ;
> //   OPENSSL_free(s) ;
>    free(s) ;
> }
> 
> int main()
> {
> 
> EC_KEY *key;
>  
> if(NULL == (key = EC_KEY_new_by_curve_name(NID_sect113r1)))
> handleErrors();
> 
> if(1 != EC_KEY_generate_key(key)) handleErrors();
> 
> BIGNUM *prv = EC_KEY_get0_private_key(key);
> BIGNUM *pub = EC_KEY_get0_public_key(key); //
> 
> */* Is this the right way to get the public key or do I need to use
> the Generator to get the public key*/ *

Yes, you can call EC_KEY_get0_public_key to get the public key, but this
function returns an EC_POINT not a BIGNUM.

Matt
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to