lightsword
Version:
LightSword Secure SOCKS5 Proxy / iOS VPN Server
24 lines (23 loc) • 725 B
JavaScript
//-----------------------------------
// Copyright(c) 2015 Neko
//-----------------------------------
;
const stream = require('stream');
const crypto = require('crypto');
class CipherStream extends stream.Transform {
constructor(encryptOrDecrypt, algorithm, key, iv, segmentSize) {
super();
this.encrypt = false;
this.algorithm = '';
this.encrypt = encryptOrDecrypt;
this.algorithm = algorithm;
this.key = key;
this.iv = iv;
this.segmentSize = segmentSize;
}
_transform(chunk, encoding, done) {
let me = this;
let cipher = crypto.createCipheriv(me.algorithm, me.key, me.iv);
}
}
exports.CipherStream = CipherStream;