0

以下のコード スニペットを実行すると、TypeError: Cannot read property 'elGamal' of undefinedというエラーが表示されます

    var sjcl = require("sjcl");
    var keys = sjcl.ecc.elGamal.publicKey(); //choose a stronger/weaker curve

    var pubkem = keys.pub.kem(); //KEM is Key Encapsulation Mechanism
    var pubkey = pubkem.key;
    var seckey = keys.sec.unkem(pubkem.tag); //tag is used to derive the secret (private) key

    var plain = "hello world!";
    var cipher = sjcl.encrypt(pubkey, plain); //defaults to AES
    var result = sjcl.decrypt(seckey, cipher);

    console.log(plain === result); //true
4

0 に答える 0