I would to know how to generate a key with the ECDSA algorithm from
openssl or do I have to use the ECDH algorithm for that?  If I have
to use ECDH, how do I generate a key?  ECDH is only to share a

secret key.

Neither ECDSA or ECDH will generate an EC key. Assuming you have a key, ECDSA is used to sign a document, and ECDH is used in various ways, but ultimately to have both parties agree on a symmetric key. You will want to read up on signatures and key agreement/key exchange. May I suggest starting with...
   http://en.wikipedia.org/wiki/Elliptic_Curve_DSA
   http://en.wikipedia.org/wiki/Elliptic_Curve_Diffie-Hellman

Here are a few clues on how to do an EC keygen. It is abbreviated from a Python wrapper I'm writing but you should be able to figure out the correct C data types.
     curveName = 'prime256v1'
     curveNID = OBJ_sn2nid(curveName)
     key = EC_KEY_new_by_curve_name(curveNID)
     EC_KEY_generate_key(key)

An other question: I am doing cryptograhy with EDCSA an/or ECDH I would like to use less code lines from openssl as possible. What should I keep or leave
from the code.

What you keep or can safely discard depends on what it is you are trying to accomplish. Perhaps you can be more specific?

Larry

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

Reply via email to