0

I would like to use the Closure-Library to encode data with AES.

When studying the library I found this aes-test: https://github.com/google/closure-library/blob/master/closure/goog/crypt/aes_test.js and the implementation with following warning:

WARNING: This is ECB mode only. If you are encrypting something longer than 16 bytes, or encrypting more than one value with the same key (so basically, always) you need to use this with a block cipher mode of operation. See goog.crypt.Cbc.

I wonder how I can use this library to encode larger blocks with the AES algorithm.

I would like to use an IV, like this CryptoJS example does:

var encoded = CryptoJS.AES.decrypt(DATA, KEY, IV);

I also could use parts of the end-to-end library ( https://code.google.com/p/end-to-end/source/browse/javascript/crypto/e2e#e2e%2Fsymmetric ) which also provides an aes encryption. However, I have don't know how to work with this implementation either.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
crypton00b
  • 85
  • 1
  • 6

1 Answers1

1

Both the CryptoJS decrypt call you've specified as well as the the code in crypt.Cbc uses CBC mode of operation. ECB mode should not be used. Try and implement CBC and ask a specific new question if you get stuck.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263