[英]Stanford Javascript Crypto Library (SJCL): How to build sjcl.js and include the CBC mode
I'm following the install here but running into trouble: 我正在这里进行安装,但是遇到了麻烦:
https://github.com/bitwiseshiftleft/sjcl/blob/version-0.8/README/INSTALL https://github.com/bitwiseshiftleft/sjcl/blob/version-0.8/README/INSTALL
npm install sjcl
pushd node_modules/sjcl; ./configure --without-all --with-aes --with-sha512 --with-cbc --with-codecHex && make; popd
This is the output from the configure and make above: 这是上述configure和make的输出:
Enabled components:
aes
bitArray
codecString
codecHex
sha512
cbc
Compression: closure
cat core/sjcl.js core/aes.js core/bitArray.js core/codecString.js core/codecHex.js core/sha512.js core/cbc.js > core.js
compress/compress_with_closure.sh core.js > core_closure.js
cp core_closure.js sjcl.js
It looks perfect, CBC was in the list. 看起来很完美,CBC在列表中。 Also, verify that it was included:
另外,请验证其中是否包含:
egrep sjcl.mode.cbc node_modules/sjcl/sjcl.js
...{sjcl.mode.cbc={name:"cbc",encrypt:...
Great it was. 太好了。 In my code, I can require in sjcl, but the sjcl.mode.cbc is undefined:
在我的代码中,我可以在sjcl中进行要求,但是sjcl.mode.cbc是未定义的:
nodejs -e "sjcl=require('sjcl'); console.log(sjcl.mode);"
{}
This means the mode variable has nothing attached. 这意味着mode变量不附加任何内容。 I would hope to see the cbc function attached there so I can use it.
我希望看到那里附有cbc函数,以便可以使用它。 How can I get a reference to and use cbc functions like
encrypt
? 我怎样才能得到一个参考和使用CBC功能,如
encrypt
?
you have to enable cbc manually in your code by calling 您必须通过调用在代码中手动启用cbc
sjcl.beware["CBC mode is dangerous because it doesn't protect message integrity."]()
https://github.com/bitwiseshiftleft/sjcl/issues/198#issuecomment-61111876 https://github.com/bitwiseshiftleft/sjcl/issues/198#issuecomment-61111876
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.