Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query: curve25519-donna #21

Closed
mrose17 opened this issue Jan 15, 2015 · 5 comments · Fixed by #22
Closed

query: curve25519-donna #21

mrose17 opened this issue Jan 15, 2015 · 5 comments · Fixed by #22

Comments

@mrose17
Copy link

mrose17 commented Jan 15, 2015

i have been looking around for a pure-javascript implementation of the "donna" -- https://code.google.com/p/curve25519-donna/ & http://cr.yp.to/ecdh.html

i have a sneaking suspicion that this is implemented in elliptic, although with a slightly different API/naming convention. am i right or just optimistic?

sorry for the lack of clue. thanks!

@indutny
Copy link
Owner

indutny commented Jan 16, 2015

It seems to be just an alternative name for curve25519.

In this case - you could use either new elliptic.ec('curve25519') for ECDH(E) or new elliptic.ec('ed25519') for ECDSA.

@indutny indutny closed this as completed Jan 16, 2015
@mrose17
Copy link
Author

mrose17 commented Jan 16, 2015

thanks very much for the reply. i was thinking that new elliptic.ec('curve25519') was the entry point for http://cr.yp.to/ecdh.html ...

what i wanted to confirm then is this: given key1 = ec.genKeyPair()

  • key1.getPrivate('hex') corresponds to a 32-octet secret key with the bit manipulation on the first and final octets
  • key1.getPublic() corresponds to a 32-octet public key corresponding to the secret key
  • key1.derive(key2.getPublic()) corresponds to the 32-octet shared secret between key1 and another key, key2

what has me stumped is this: key1.getPublic('hex') throws an error in my test file:

node donna.js

/Users/mrose/Downloads/elliptic-master/lib/elliptic/ec/key.js:83
    var y = this.pub.getY().toArray();
                     ^
TypeError: Object #<Point> has no method 'getY'
    at KeyPair.getPublic (/Users/mrose/Downloads/elliptic-master/lib/elliptic/ec/key.js:83:22)
    at Object.<anonymous> (/Users/mrose/Downloads/elliptic-master/donna.js:9:32)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

so either i shouldn't be calling key1.getPublic with a parameter of hex or getY ought to be defined in mont.js in addition to short.js and edwards.js

sorry for the newbie questions... and, honestly, few things make me happier in my professional life that looking for a javascript-only implementation of something really complicated and finding it! many thanks!

@indutny
Copy link
Owner

indutny commented Jan 16, 2015

@mrose17 ouch, you are right! Fixing it.

@mrose17
Copy link
Author

mrose17 commented Jan 16, 2015

@indutny - thanks! could i ask you to re-open the issue and then close it again, when it's fixed.

sorry!

@indutny
Copy link
Owner

indutny commented Jan 16, 2015

@mrose17 please take a look at #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants