我想加密和解密我的xml文件。
我读过关于这个过程的w3c推荐。
通过一些搜索,我找到了NPMXMLEncryption1.2.0
https://www.npmjs.com/package/xml-encryption
以前有人试过吗?
我安装了它,但它显示了错误
“要求未定义”
,你们还有其他加密xml?的方法吗?
我的代码
<html>
<head>
<script>
var xmlenc = require('xml-encryption');
var options = {
rsa_pub: fs.readFileSync('./public.pem'),
pem: fs.readFileSync('./public.pem'),
encryptionAlgorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc',
keyEncryptionAlgorithm: 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p',
disallowEncryptionWithInsecureAlgorithm: true,
warnInsecureAlgorithm: true
};
xmlenc.encrypt('content to encrypt', options, function(err, result) {
console.log(result);
})
</script>
</head>
<body>
</body>
</html>发布于 2020-06-09 19:36:56
我在这里找到了解决办法
首先,我认为这个错误与xml加密包有关,因为我已经安装了nodejs。
https://stackoverflow.com/questions/62271946
复制相似问题