在节点js中未定义spkac吗?

时间:2018-09-17 12:46:25

标签: node.js cryptography node-modules cryptojs

我正在尝试对字符串进行加密以获取此错误。

代码:

const crypto = require('crypto');
const secret = 'abcdefg';
const hash = crypto.createHmac('sha256', secret)
                   .update('I love cupcakes')
                   .digest('hex');
console.log(hash);
const cert = require('crypto').Certificate();
try{
    const spkac = getSpkacSomehow();
    const challenge = cert.exportChallenge(spkac);
    console.log(challenge.toString('utf8'));
}
catch(err){
    console.log('error'+err);
}

我得到的错误:

errorReferenceError: getSpkacSomehow is not defined

0 个答案:

没有答案