PidCrypt AES decrypt error - byteArray2String is not defined

610 views Asked by At

I am trying use pidCrypt (javascript library https://sourceforge.net/projects/pidcrypt/) to decrypt crypted text by AES.

MAC mini, OS X Yosemite, v.10.10.1
Mozilla FF 35.0.1

I using this files:

 <SCRIPT src="javascripts/pidcrypt_util.js"></SCRIPT>
 <SCRIPT src="javascripts/pidcrypt.js"></SCRIPT>
 <SCRIPT src="javascripts/md5.js"></SCRIPT><!--needed for key and iv generation-->
 <SCRIPT src="javascripts/aes_core.js"></SCRIPT><!--needed block en-/decryption-->
 <SCRIPT src="javascripts/aes_cbc.js"></SCRIPT><!--needed for cbc mode-->

And making new instance:

 var aes = new pidCrypt.AES.CBC();

After this i get error:

ReferenceError: byteArray2String is not defined
this.params.salt = byteArray2String(getRandomBytes(8)).convertToHex();
pidcrypt.js (line 93, col 5)

Same problem is if i launch test file packed with library (test_aes-cbc.html)

Sloution:

I was fixed this that way:

Remove from pidcrypt.js:

line 93: this.params.salt = byteArray2String(getRandomBytes(8)).convertToHex();

Add to pidcrypt.js:

line 93: this.params.salt = pidCryptUtil.byteArray2String(getRandomBytes(8));
line 94: this.params.salt = pidCryptUtil.convertToHex(this.params.salt);

If anybody have additional info/notes to this edit plesae comment.

0

There are 0 answers