cryptography - How to use crypto.createSign with a DiffieHellman private key in node.js? -


i'm trying use dh private key sign message node crypto lib. i'm running error can't seem fix :{

var crypto = require("crypto");  var bob = crypto.getdiffiehellman("modp17");  bob.generatekeys();  var sign = crypto.createsign("rsa-sha256");  sign.write("hello world");  var message = sign.sign(bob.getprivatekey()); 

error

140735140705040:error:0906d06c:pem routines:pem_read_bio:no start line:../deps/openssl/openssl/crypto/pem/pem_lib.c:703:expecting: private key error: signfinal error     @ sign.sign (crypto.js:398:27)     @ repl:1:18     @ replserver.self.eval (repl.js:110:21)     @ repl.js:249:20     @ replserver.self.eval (repl.js:122:7)     @ interface.<anonymous> (repl.js:239:12)     @ interface.emit (events.js:95:17)     @ interface._online (readline.js:202:10)     @ interface._line (readline.js:531:8)     @ interface._ttywrite (readline.js:760:14) 

the private key getprivatekey() not in pem format, what sign() expecting.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -