节点.js代理请求并使用 AES 对其进行加密
Node.js proxy request and encrypt it using AES
在
Express 应用程序中,对将请求代理到另一台服务器并在将响应发送到客户端(将在其中解密)之前对响应进行编码的最简单方法是什么?是否可以使用流来完成所有这些操作?
var request = require('request'),
http = require('http'),
crypto = require('crypto'),
acceptor = http.createServer().listen(8089);
acceptor.on('request', function(r, s) {
var ciph = crypto.createCipher('aes192', 'mypassword');
// simple stream object to convert binary to string
var Transform = require('stream').Transform;
var BtoStr = new Transform({decodeStrings: false});
BtoStr._transform = function(chunk, encoding, done) {
done(null, chunk.toString('base64'));
};
// get html from Goog, could be made more dynamic
request('http://google.com').pipe(ciph).pipe(BtoStr).pipe(s);
// try encrypt & decrypt to verify it works, will print cleartext to stdout
//var decrypt = crypto.createDecipher('aes192', 'mypassword');
//request('http://google.com').pipe(ciph).pipe(decrypt).pipe(process.stdout);
})
相关文章:
- 如何正确使用AES加密
- 使用PKCS7Padding在python和Node.js之间进行AES加密
- AES-CTR 在 Go 中加密,在 CryptoJS 中解密
- 如何将HMAC添加到CryptoJS AES加密中
- react本机AES加密匹配Java解密算法
- javascript中的AES加密和java中的解密
- 在Visual Basic中加密AES,然后在服务器到客户端中解密AES
- Node.js对外部PHP aes-256-cbc进行解密,然后对其进行加密
- AES JavaScript加密和Java解密
- CryptoJS AES加密不是对称的
- 创建 CryptoJS AES 密码加密器以在 .NET 中解密
- Websockets聊天消息加密与AES,Crypto.js和.NET
- 将 Java AES 加密代码移植到 node.js
- 节点.js代理请求并使用 AES 对其进行加密
- 节点.js使用 AES 加密大文件
- 有人可以帮助我让我的AES加密在Java,Javascript和C#之间工作吗?
- CryptoJS使用密码短语加密AES,但PHP解密需要密钥
- 加密Aes解密在php不工作
- Node.js/javascript加密AES-128像mcrypt_ecb在PHP
- Node.js加密aes-256-cbc-hmac-sha1不能工作