Re: Diffie algorithm in openssl: and Java

2013-03-25 Thread azhar jodatti
Thanks for the explanation and help.. everything worked perfect. :) :) Regards, Azhar On Mon, Mar 25, 2013 at 1:34 PM, Dave Thompson wrote: > > From: owner-openssl-us...@openssl.org On Behalf Of Dave Thompson > > Sent: Wednesday, 20 March, 2013 20:21 > > > >From: owner-openssl-us...@openssl.or

RE: Diffie algorithm in openssl: and Java

2013-03-25 Thread Dave Thompson
> From: owner-openssl-us...@openssl.org On Behalf Of Dave Thompson > Sent: Wednesday, 20 March, 2013 20:21 > >From: owner-openssl-us...@openssl.org On Behalf Of azhar jodatti > >Sent: Wednesday, 20 March, 2013 15:21 > >this.secretKey is an object of javax.crypto.SecretKey which > >I am using for

RE: Diffie algorithm in openssl: and Java

2013-03-20 Thread Dave Thompson
>From: owner-openssl-us...@openssl.org On Behalf Of azhar jodatti >Sent: Wednesday, 20 March, 2013 15:21 >On Wed, Mar 20, 2013 at 5:12 PM, Matt Caswell wrote: > On 20 March 2013 11:25, azhar jodatti wrote: > > byte[] bobPubKeyEnc = bobKpair.getPublic().getEncoded();

Re: Diffie algorithm in openssl: and Java

2013-03-20 Thread Matt Caswell
On 20 March 2013 19:21, azhar jodatti wrote: > One more query :). > > After generating secret key : > byte[] bobSharedSecret = bobKeyAgree.generateSecret();//this generates > secret key. Note : this key matches with C client secret key :) > > I am doing below stuff in JAVA : >SecretKeyFac

Re: Diffie algorithm in openssl: and Java

2013-03-20 Thread azhar jodatti
On Wed, Mar 20, 2013 at 5:12 PM, Matt Caswell wrote: > On 20 March 2013 11:25, azhar jodatti wrote: > > byte[] bobPubKeyEnc = bobKpair.getPublic().getEncoded(); > > This is providing an encoded form of the public key, whereas your code > is expecting it as an integer. Use the following instead:

Re: Diffie algorithm in openssl: and Java

2013-03-20 Thread Matt Caswell
On 20 March 2013 11:25, azhar jodatti wrote: > byte[] bobPubKeyEnc = bobKpair.getPublic().getEncoded(); This is providing an encoded form of the public key, whereas your code is expecting it as an integer. Use the following instead: DHPublicKey dhpubkey = (DHPublicKey)(bobKpair.getPublic()); Big

Re: Diffie algorithm in openssl: and Java

2013-03-20 Thread azhar jodatti
On Wed, Mar 20, 2013 at 3:44 PM, Matt Caswell wrote: > On 20 March 2013 07:37, azhar jodatti wrote: > >> Public key : > >> > 510930286596310951521275475612102569543976030982320596660271226159732273824290276894393668009018948652558944129592742623399736587550878753266525193164086412911472101163507

Re: Diffie algorithm in openssl: and Java

2013-03-20 Thread Matt Caswell
On 20 March 2013 07:37, azhar jodatti wrote: >> Public key : >> 510930286596310951521275475612102569543976030982320596660271226159732273824290276894393668009018948652558944129592742623399736587550878753266525193164086412911472101163507241794456000621904406552477307648348188701130736756595973501460

Re: Diffie algorithm in openssl: and Java

2013-03-20 Thread azhar jodatti
On Tue, Mar 19, 2013 at 8:13 PM, Matt Caswell wrote: > On 19 March 2013 14:18, azhar jodatti wrote: > > On Tue, Mar 19, 2013 at 6:24 PM, Matt Caswell wrote: > >> On 19 March 2013 12:22, azhar jodatti wrote: > >> >PEM_write_bio_DHparams(out, temp);//this prints public key in > >> > base

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread Matt Caswell
On 19 March 2013 14:18, azhar jodatti wrote: > On Tue, Mar 19, 2013 at 6:24 PM, Matt Caswell wrote: >> On 19 March 2013 12:22, azhar jodatti wrote: >> >PEM_write_bio_DHparams(out, temp);//this prints public key in >> > base64 >> > (this is what i think :) ) >> >> This is NOT a base64 rep

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread azhar jodatti
On Tue, Mar 19, 2013 at 6:24 PM, Matt Caswell wrote: > On 19 March 2013 12:22, azhar jodatti wrote: > >PEM_write_bio_DHparams(out, temp);//this prints public key in > base64 > > (this is what i think :) ) > > This is NOT a base64 representation of the public key. This is > printing out t

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread Matt Caswell
On 19 March 2013 12:22, azhar jodatti wrote: >PEM_write_bio_DHparams(out, temp);//this prints public key in base64 > (this is what i think :) ) This is NOT a base64 representation of the public key. This is printing out the parameters only (which does not include the public key) >

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread azhar jodatti
​Well, to roll out the possibility of network error's, JSON values not being passed properly and blah blah blah I just dropped that approach. instead of that I am running C program which prints the prime,generator and public key. I have another program on same machine which is written in java where

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread Matt Caswell
On 19 March 2013 10:37, azhar jodatti wrote: > > > On Tue, Mar 19, 2013 at 2:58 PM, Matt Caswell wrote: >> >> On 19 March 2013 09:01, azhar jodatti wrote: >> >> > And possibly relevant here, the standard Suncle JCE provider actually >> > uses DSA paramgen for DH and thus imposes the DSA size res

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread azhar jodatti
On Tue, Mar 19, 2013 at 2:58 PM, Matt Caswell wrote: > On 19 March 2013 09:01, azhar jodatti wrote: > > > And possibly relevant here, the standard Suncle JCE provider actually > > uses DSA paramgen for DH and thus imposes the DSA size restrictions > > on DH -- 512 to 1024 in steps of 64 -- altho

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread Matt Caswell
On 19 March 2013 09:01, azhar jodatti wrote: > And possibly relevant here, the standard Suncle JCE provider actually > uses DSA paramgen for DH and thus imposes the DSA size restrictions > on DH -- 512 to 1024 in steps of 64 -- although they aren't required > by any standard I know of. I don't re

Re: Diffie algorithm in openssl: and Java

2013-03-19 Thread azhar jodatti
​<-- And possibly relevant here, the standard Suncle JCE provider actually uses DSA paramgen for DH and thus imposes the DSA size restrictions on DH -- 512 to 1024 in steps of 64 -- although they aren't required by any standard I know of. I don't recall if JCE also restricts *existing* (received)

Re: Diffie algorithm in openssl: and Java

2013-03-18 Thread Matt Caswell
On 18 March 2013 21:44, Matt Caswell wrote: > However, you are correct that the DH computation does not use q, although > I do not > > know whether JCE requires it to be specified (not having used JCE). > > One other point on this - X9.42 describes an optional validation procedure which does use

Re: Diffie algorithm in openssl: and Java

2013-03-18 Thread Matt Caswell
On 18 March 2013 21:02, Dave Thompson wrote: > >I also just noticed that in your JSON sample there is only one > >prime number provided. There are in fact two required: p and q. > > No. *DSA* uses p,q,g. DH requires p,g which effectively determines > q, but DH computation doesn't use q and standa

RE: Diffie algorithm in openssl: and Java

2013-03-18 Thread Dave Thompson
>From: owner-openssl-us...@openssl.org On Behalf Of Matt Caswell >Sent: Monday, 18 March, 2013 09:17 >On 18 March 2013 12:15, azhar jodatti wrote: >2) Is this sample from the *same* key exchange? The parameters are >different which are obviously going to cause it to fail. >When I run both progr

RE: Diffie algorithm in openssl: and Java

2013-03-18 Thread Dave Thompson
>From: owner-openssl-us...@openssl.org On Behalf Of azhar jodatti >Sent: Saturday, 16 March, 2013 14:00 >I am working on application which has android and iPhone client. >Both the client talk to my server which is written in JAVA. I am >using JCE implementation of DH algorithm and X509Encodedkey

Re: Diffie algorithm in openssl: and Java

2013-03-18 Thread Matt Caswell
On 18 March 2013 15:05, azhar jodatti wrote: > > I also just noticed that in your JSON sample there is only one prime > number provided. There are in fact two required: p and q. > well, I think other prime number is g and not q. other prime number is > base generator i.e g in above JSON sample. >

Fwd: Diffie algorithm in openssl: and Java

2013-03-18 Thread azhar jodatti
On 18 March 2013 12:15, azhar jodatti wrote: > 2) Is this sample from the *same* key exchange? The parameters are > different which are obviously going to cause it to fail. > When I run both programs it calculates the params (p,g,pk) every time on > execution . that's the reason both key values a

Re: Diffie algorithm in openssl: and Java

2013-03-18 Thread Matt Caswell
On 18 March 2013 12:15, azhar jodatti wrote: > 2) Is this sample from the *same* key exchange? The parameters are > different which are obviously going to cause it to fail. > When I run both programs it calculates the params (p,g,pk) every time on > execution . that's the reason both key values a

Re: Diffie algorithm in openssl: and Java

2013-03-18 Thread azhar jodatti
​1) The C version is in hex while the java version is in decimal. Is this intentional? When you are reading in the values are reading them correctly (i.e. as hex or as decimal as required) Yes. it was intentional. I am taking care of this. 2) Is this sample from the *same* key exchange? The paramet

Re: Diffie algorithm in openssl: and Java

2013-03-17 Thread azhar jodatti
​Thanks matt for looking at this. below are the details json from C with openSSL { "prime": "B01DBDE7823A696F13EEFDE810DF2A010ED8BA919186029BEECCF2F0454CE85CA3E3FFD0EB3A578F80C28930AD98559D57605E37BFE2B1BD3C6D6C7657384F4DDFF45D57C59EF2DEADAF7605A1EB36A5D5007162F026E5AE161F489C8C79A5AD10C40FC

Re: Diffie algorithm in openssl: and Java

2013-03-16 Thread azhar jodatti
​Matt, ​ ​No reason as such for using low level interface.I just want to get it done. Do you see any issues with low level interface? or any issues with my code? In addition, the server and client works over REST API's, hence I am using JSON format to pass the parameter over the wire. Regards, ​

Re: Diffie algorithm in openssl: and Java

2013-03-16 Thread Matt Caswell
On 16 March 2013 18:00, azhar jodatti wrote: > > > Thompson, > > Really thanks for the reply. appreciate your time. > > Yes it was JCE and not JCF. it was typo :) > > I am working on application which has android and iPhone client. Both the > client talk to my server which is written in JAVA. I

Re: Diffie algorithm in openssl: and Java

2013-03-16 Thread azhar jodatti
Thompson, Really thanks for the reply. appreciate your time. Yes it was JCE and not JCF. it was typo :) I am working on application which has android and iPhone client. Both the client talk to my server which is written in JAVA. I am using JCE implementation of DH algorithm and X509EncodedkeySp

RE: Diffie algorithm in openssl: and Java

2013-03-15 Thread Dave Thompson
>From: owner-openssl-us...@openssl.org On Behalf Of azhar jodatti >Sent: Wednesday, 13 March, 2013 13:44 >I was trying to implement the diffie Hellman algorithm in Java >which makes use of JCF and as well as in c with openssl... I assume you mean JCE, or maybe JCA. JCF is completely unrelated.