Well thats what I thought it seems to have its own keys but I saw functions
such as setting the points and BIGNUM and thought maybe the PEM could be
used which uses 2048 RSA.

So essentially I would have a set of ECKEYS just for the ECDSA. There is a
public eckey and private eckey
and those are written to a file I assume but with what functions and also
how to use the functions when reading from a file of the keys (Best
Practices).

I see there is this output/input function as an Octet just for public

int i2o_ECPublicKey     (       EC_KEY *        key,
unsigned char **        out 
)

EC_KEY* o2i_ECPublicKey (       EC_KEY **       key,
const unsigned char **  in,
long    len 
)       

And the private keys seems to indicate a DER

EC_KEY* d2i_ECPrivateKey        (       EC_KEY **       key,
const unsigned char **  in,
long    len 
)       

I assume the output here is DER though it does not say it.

int i2d_ECPrivateKey    (       EC_KEY *        key,
unsigned char **        out 
)               

(1) So what is the Best Practices then after a key has been generated I can
save to a file (Best Practices, private and public files?) and then I can
read from a file a public or a private key (Best Practices?)  Basically I am
interested in saving the private key for generation and handing out the
public for verifying.



As for the data that is SHA1, this was as a sample, we have META data LPIF
and so on, but simple examples are good. There is very little information on
the use of the ECKEY stuff so by me posting everyone can
share the info. Please state Best Practices for the generated keys and their
storage for ECKEY. 

By the way this is where I go for doc on ECKEY

http://openssl.sourcearchive.com/documentation/1.0.0e-2/crypto_2ec_2ec_8h_a1a93f5739c093586ef83517b52b44a0c.html#a1a93f5739c093586ef83517b52b44a0c



redpath wrote:
> 
> 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-tp34377536p34382798.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

Reply via email to