bitwiseshiftleft / sjcl

Stanford Javascript Crypto Library
http://bitwiseshiftleft.github.com/sjcl/
Other
7.19k stars 988 forks source link

Sharing ECC public keys across network #35

Open nadimkobeissi opened 13 years ago

nadimkobeissi commented 13 years ago

Is there a convenient way to share sjcl.ecc.elGamal.generateKeys(384, 10).pub across a network? The closest thing I could come to is use JSON.decycle and then stringifying the object, but retrocycling it and reparsing it on the other end does not result in an object that supports .kem. Furthermore, the resulting object is huge, over 10,000 characters.

How am I supposed to share an ECC public key with other people across a network?

bitwiseshiftleft commented 13 years ago

This functionality is under-supported (i.e. I haven't written it, and there's a patch someone sent me but I haven't reviewed it yet), but in short, you can extract the _exponent field and serialize it. Then calling sjcl.ecc.elGamal.secretKey(curve, exponent) will restore it. Likewise, you can extract the _point field from the public key and serialize it.

nadimkobeissi commented 13 years ago

Thanks very much. Is it possible for me to check out the patch you mentioned?

ys1382 commented 12 years ago

The patch is here: https://github.com/bitwiseshiftleft/sjcl/pull/41

Nilos commented 11 years ago

I created a new similar one with deserialization support and some more stuff in it: #99 Please discuss!