javascriptelliptic-curvesjcl

SJCL key generation


for my website "moneyart.info" I want to generate ECC public and private keys with JavaScript library sjcl. I tried following code:

*
crypto_keys = sjcl.ecc.elGamal.generateKeys(256);
var public_key = crypto_keys.pub.get();
var secret_key = crypto_keys.sec.get();

var public_key_hex = sjcl.codec.hex.fromBits(public_key.x) + sjcl.codec.hex.fromBits(public_key.y);
var secret_key_hex = sjcl.codec.hex.fromBits(secret_key);               

alert(secret_key_hex);*

I get the error message: TypeError: sjcl.ecc is undefined I think I have to construct a class with new, but I dont know which one.


Solution

  • I found the mistake: ecc.elGamal is no standard sjcl function. I have to compile the sjcl.js file manually with additional functionality included. blog.peramid.es