I have to decode a rijndael 128 string
the string can be successfully using this online tool http://www.tools4noobs.com/online_tools/decrypt/ with theses parameters :
- Algorythm rijndael 128
- Mode : CBC
- Decode the output using base64
I have to decode this using node.js and crypto module
Here is my code
function Token(TokenBase64 )
{
var crypto = require('crypto');
this.TokenToCheck = new Buffer(TokenBase64,'base64').toString();
this.GameKey = 'xxxxxxxxxxxxxxxxx';
var cryptKey = crypto.createHash('sha256').update(this.GameKey).digest()
this.decipher = crypto.createDecipheriv('aes-128-cbc', cryptKey, '12345678901234561234567890123456');
var dec = this.decipher.update( this.TokenToCheck);
dec += this.decipher.final();
return dec;
}
module.exports = Token;
The error output by this code when called is :
Error: DecipherInitIv error at new Decipheriv (crypto.js:360:17) at Object.Decipheriv (crypto.js:357:12) at new Token