RE: Need help in loading private key for ECDSA

2012-12-18 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of jeetendra gangele Sent: Monday, 17 December, 2012 21:48 Yes i used [KDF1_SHA1 for ECDH_compute_key] from ec/ecdhtest.c. If you see the ECDH_compute_key in last argument It need some hash function to sign the shared secret. The last argument

RE: Need help in loading private key for ECDSA

2012-12-17 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of jeetendra gangele Sent: Monday, 17 December, 2012 01:58 Its generating 64 bytes when I print with ECDSA_size(eckey) But i neeed 56 bytes signature. [for secp224r1] ECDSA_size is the *maximum* length of the encoded signature, see the man

RE: Need help in loading private key for ECDSA

2012-12-17 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of jeetendra gangele Sent: Monday, 17 December, 2012 02:48 Yes i am talking about signature. ECDSA_SIG this ouptput structure will have r and s componet of 28 bytes each. [for 224-bit curve] So if I merge both r and s I will get 56 bytes

Re: Need help in loading private key for ECDSA

2012-12-17 Thread jeetendra gangele
Thanks for ur help . Can you guide me how can I use ECDH for exachnaging of the secret key. I have to implement in two phases. 1.i have private key of 256 bit lenght need to get phase i1 value wx,wy 2.In second I have phase1 value and private key and need to get secret key or public key.

Re: Need help in loading private key for ECDSA

2012-12-17 Thread jeetendra gangele
I need to use ECDH to derive the shared key using public and private key given. On 17 December 2012 18:56, jeetendra gangele gangele...@gmail.com wrote: Thanks for ur help . Can you guide me how can I use ECDH for exachnaging of the secret key. I have to implement in two phases. 1.i

Re: Need help in loading private key for ECDSA

2012-12-17 Thread jeetendra gangele
HI for ECDH can I use the HAs256 algorithm. I have gone through the inside DS and written this piece of code and it worked also. But here how can U sesha256 ,when i used i am getting the error. How can i use here sha256? int alen = 0; int blen = 0; int aout = 0; int bout = 0;

RE: Need help in loading private key for ECDSA

2012-12-17 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of jeetendra gangele Sent: Monday, 17 December, 2012 13:17 HI for ECDH can I use the HAs256 algorithm. I have gone through the inside DS and written this piece of code and it worked also. But here how can U sesha256 ,when i used i am getting

RE: Need help in loading private key for ECDSA

2012-12-17 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of jeetendra gangele Sent: Monday, 17 December, 2012 08:26 To: openssl-users@openssl.org Subject: Re: Need help in loading private key for ECDSA Thanks for ur help . Can you guide me how can I use ECDH for exachnaging of the secret

Re: Need help in loading private key for ECDSA

2012-12-17 Thread jeetendra gangele
Yes i used from ec/ecdhtest.c. If you see the ECDH_compute_key in last argument It need some hash function to sign the shared secret. And here I need 256 bit secret key,that will be point on curve?. That why I tried to use here sha256,because sha1 is 20bytes . Also ECDH_compute_key for this fun

Re: Need help in loading private key for ECDSA

2012-12-17 Thread jeetendra gangele
Actaully here I need to write the hash function which generate the 448 bit hash value. By looking into openssl I did not find any hash function which can generate the 448 bit. Do we have any library function for generating 448 bit hash value? On 18 December 2012 08:18, jeetendra gangele

Re: Need help in loading private key for ECDSA

2012-12-16 Thread jeetendra gangele
Actaully I was trying to generate the signature of lenght 56 bytes but its failing. When I check the code it said lenght of the sig should not lessa than 56. can anybody help me how can I generate the signature of lenght 56 bytes?. On 14 December 2012 19:11, Matt Caswell (fr...@baggins.org)

Re: Need help in loading private key for ECDSA

2012-12-16 Thread jeetendra gangele
Can anybody guide me how can I generate the digital signature of 56 bytes for ecdsa. I am using the curve NID_secp224r1. Thanks jeetendra On 17 December 2012 09:26, jeetendra gangele gangele...@gmail.com wrote: Actaully I was trying to generate the signature of lenght 56 bytes but its failing.

Re: Need help in loading private key for ECDSA

2012-12-16 Thread jeetendra gangele
Its generating 64 bytes when I print with ECDSA_size(eckey) But i neeed 56 bytes signature. On 17 December 2012 12:26, jeetendra gangele gangele...@gmail.com wrote: Can anybody guide me how can I generate the digital signature of 56 bytes for ecdsa. I am using the curve NID_secp224r1. Thanks

RE: Need help in loading private key for ECDSA

2012-12-16 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of jeetendra gangele Sent: Sunday, 16 December, 2012 22:57 Actaully I was trying to generate the signature of lenght 56 bytes but its failing. When I check the code it said lenght of the sig should not lessa than 56. can anybody help me how

Re: Need help in loading private key for ECDSA

2012-12-16 Thread jeetendra gangele
Yes i am talking about signature. ECDSA_SIG this ouptput structure will have r and s componet of 28 bytes each. So if I merge both r and s I will get 56 bytes right? These will not have any padding information?. Thanks jeet On 17 December 2012 13:04, Dave Thompson dthomp...@prinpay.com wrote:

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
char b1[] = 18679335321211177614181391980475641049275229937844945546185683145837; Where did you get this value from? Is this a private key you have been provided with that you *must* use? Unless you particularly need to use a specific private key it is better to use EC_KEY_generate_key

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
But why we need to load the public key for signing the data? for signing I need only private key. When I load the public and private both key I could sign the data. but when I load only private key and calling Key_check function its failing. Thanks Jeetendra On 14 December 2012 15:32, Matt

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
On 14 December 2012 10:32, jeetendra gangele gangele...@gmail.com wrote: But why we need to load the public key for signing the data? for signing I need only private key. When I load the public and private both key I could sign the data. but when I load only private key and calling Key_check

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
Okay, Thankd for ur reply. If i have only private key in my ECC_key object Will be able to sign the data?. I mean i will load only private key and use the curve.Will I be able to sign the data? and How can i load other parametes like a,b,g,n in to the object. On 14 December 2012 16:12, Matt

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
On 14 December 2012 11:14, jeetendra gangele gangele...@gmail.com wrote: Okay, Thankd for ur reply. If i have only private key in my ECC_key object Will be able to sign the data?. I've not tried it, so I'm not sure. I've had a quick review of the code and I can't see any reason why not,

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
Thanks But i have these parameters and I wanted to load them p,a,b,q Do u know how can i load them? Thanks jeetendra On 14 December 2012 17:10, Matt Caswell (fr...@baggins.org) fr...@baggins.org wrote: On 14 December 2012 11:14, jeetendra gangele gangele...@gmail.com wrote: Okay, Thankd

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
sorry its p,a,b,x,y On 14 December 2012 17:17, jeetendra gangele gangele...@gmail.com wrote: Thanks But i have these parameters and I wanted to load them p,a,b,q Do u know how can i load them? Thanks jeetendra On 14 December 2012 17:10, Matt Caswell (fr...@baggins.org)

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
On 14 December 2012 11:47, jeetendra gangele gangele...@gmail.com wrote: Thanks But i have these parameters and I wanted to load them p,a,b,q Do u know how can i load them? The parameters are related to the definition of the curve. Where did you get the parameters from? Are you sure they are

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
I got these parameters from marlin and I wanted to load these parameter. Its must for me to load these parameters. On 14 December 2012 17:37, Matt Caswell (fr...@baggins.org) fr...@baggins.org wrote: On 14 December 2012 11:47, jeetendra gangele gangele...@gmail.com wrote: Thanks But i have

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
Ok Do you know if there any dependency between these curve parameters and private and public key.? I mean I am loading these parameters and generating private and public keys from Openssl command line tools. It did not worked for me . but when i use standard curve and load public and private keys

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
On 14 December 2012 12:37, jeetendra gangele gangele...@gmail.com wrote: I got these parameters from marlin and I wanted to load these parameter. Its must for me to load these parameters. I am not familiar with what marlin is, so I cannot advise on that. I would double check that the

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
Yes there is a dependency. The curve parameters define what the curve is, whilst the public key is a point on the curve. The public key is inherently linked to the curve parameters. If you change the parameters then the public key will no longer be valid. Matt On 14 December 2012 12:42,

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
Ok, So is there any way after setting these parameters I can get the public key(point) on curve.? after setting the curve parameter I can ask for point in the curve there is one API I have seen right? GetPublicKey. Can u do that from command line? thanks jeetendra On 14 December 2012 18:40, Matt

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
On 14 December 2012 13:36, jeetendra gangele gangele...@gmail.com wrote: Ok, So is there any way after setting these parameters I can get the public key(point) on curve.? Setting the parameters just gets you a curve, not a private/public key pair. To create a private/public key pair create

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
it looks very odd loading of public key during sign operation. Ok tell me one thing I can load any valid point on the curve during sign. and whn I verify the signed message i should be able to verify with the other valid public key? Thanks jeet On 14 December 2012 19:11, Matt Caswell

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
On 14 December 2012 14:20, jeetendra gangele gangele...@gmail.com wrote: it looks very odd loading of public key during sign operation. Ok tell me one thing I can load any valid point on the curve during sign. An ECDSA sign operates on the curve and associated parameters, the private key, and

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
On 14 December 2012 20:18, Matt Caswell (fr...@baggins.org) fr...@baggins.org wrote: On 14 December 2012 14:20, jeetendra gangele gangele...@gmail.com wrote: it looks very odd loading of public key during sign operation. Ok tell me one thing I can load any valid point on the curve during

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
On 14 December 2012 15:02, jeetendra gangele gangele...@gmail.com wrote: On 14 December 2012 20:18, Matt Caswell (fr...@baggins.org) fr...@baggins.org wrote: On 14 December 2012 14:20, jeetendra gangele gangele...@gmail.com wrote: it looks very odd loading of public key during sign

Re: Need help in loading private key for ECDSA

2012-12-14 Thread jeetendra gangele
On 14 December 2012 20:39, Matt Caswell (fr...@baggins.org) fr...@baggins.org wrote: On 14 December 2012 15:02, jeetendra gangele gangele...@gmail.com wrote: On 14 December 2012 20:18, Matt Caswell (fr...@baggins.org) fr...@baggins.org wrote: On 14 December 2012 14:20, jeetendra gangele

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Matt Caswell (fr...@baggins.org)
Yes i did same thanks for all ur support. Is there any relation between curve parameter and private key or private key can be any random number? Yes there is a relationship. The private key must be a random number between 0 and the order of the curve. As far I remeber there is relation

Re: Need help in loading private key for ECDSA

2012-12-14 Thread Jeffrey Walton
On Thu, Dec 13, 2012 at 7:21 PM, Dave Thompson dthomp...@prinpay.com wrote: From: owner-openssl-us...@openssl.org On Behalf Of Jeffrey Walton Sent: Thursday, 13 December, 2012 16:31 On Thu, Dec 13, 2012 at 12:34 AM, jeetendra gangele gangele...@gmail.com wrote: snip ... Nit: the primitive

RE: Need help in loading private key for ECDSA

2012-12-14 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Matt Caswell (fr...@baggins.org) Sent: Friday, 14 December, 2012 08:42 On 14 December 2012 13:36, jeetendra gangele gangele...@gmail.com wrote: snip Can u do that from command line? As far as I know you can't use custom curves from

Re: Need help in loading private key for ECDSA

2012-12-13 Thread Jeffrey Walton
On Thu, Dec 13, 2012 at 12:34 AM, jeetendra gangele gangele...@gmail.com wrote: Hi i tried to load private key into 224 curve for ecdsa and I am getting below error. EC_KEY_check_key failed: error:100B1043:lib(16):func(177):reason(67). Bleow is my fun to load key. Can anybody guide me? $

RE: Need help in loading private key for ECDSA

2012-12-13 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Jeffrey Walton Sent: Thursday, 13 December, 2012 16:31 On Thu, Dec 13, 2012 at 12:34 AM, jeetendra gangele gangele...@gmail.com wrote: snip I have not really been following this thread, so please forgive my dumb questions. Are you using