Currently I am reading a PEM file which contains a test RSA key /** *Load RSA Keys **/ fp= fopen("test.pem", "rb"); if (fp==NULL){ printf("ERROR opening RSA Keys failed test.pem\n"); return 1; } rsapriv= (RSA *) PEM_read_RSAPrivateKey(fp,&rsapriv, (pem_password_cb *)"password",NULL);
and create a SHA1 message digest unsigned char *result=SHA1((unsigned char *)sample, strlen(sample), md); and sign it int rc= RSA_sign(NID_sha1, md, 20, sigret, &siglen, rsapriv); Now I have explored also the use of the Elliptical Curve from the SHA1 but and there is always a but, the only example I could figure out is using the key generation function EC_KEY_generate_key(eckey); <==== I need to use my private and public key from the RSA PEM file? Not sure how exactly to do this. The private would be used for the ECDSA_do_sign(md, 20, eckey); The public later is used for verify ECDSA_do_verify(md, 20, sig, eckey); The RSA structure consists of several BIGNUM components. It can contain public as well as private RSA keys: struct { BIGNUM *n; // public modulus BIGNUM *e; // public exponent BIGNUM *d; // private exponent BIGNUM *p; // secret prime factor BIGNUM *q; // secret prime factor BIGNUM *dmp1; // d mod (p-1) BIGNUM *dmq1; // d mod (q-1) BIGNUM *iqmp; // q^-1 mod p // ... }; RSA There are functions for ECDSA such as int EC_KEY_set_private_key(EC_KEY *, const BIGNUM *) and int EC_KEY_set_public_key(EC_KEY *, const EC_POINT *) EC_POINT_point2bn(group, point, POINT_CONVERSION_UNCOMPRESSED, ppub_a, ctx); The POINT is used for the public key of EC_KEY no real document of how this is used. So simply I have a PEM which gives me a RSA* and want to use the public and privates keys for the ECDSA. How? -- View this message in context: http://old.nabble.com/EC_KEY-and-PEM_read_RSAPrivateKey-tp34377536p34377536.html Sent from the OpenSSL - Dev mailing list archive at Nabble.com. ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org