How do I use CryptoJS to generate a CBC-MAC (*not HMAC) block cipher with Triple DES. I can't seem to find it in the documentation.
Asked
Active
Viewed 489 times
1
-
1CryptoJS doesn't provide this primitive, so you will need to implement it yourself, but it's hard to get it right: http://blog.cryptographyengineering.com/2013/02/why-i-hate-cbc-mac.html – Artjom B. Mar 11 '15 at 08:36
-
@ArtjomB. thanks. yeah a tough one – codemonk Mar 11 '15 at 13:38
-
1If you go this way you may want to go one step further and implement CMAC instead (which in turn can be build upon CBC-MAC). CBC-MAC has some weaknesses that are addressed by CMAC. Note that using CBC-MAC or CMAC is not such a good idea with an 8 byte block cipher such as DES or triple DES. Unless you are trying to accomplish backwards compatibility, opt for HMAC instead. If possible, differentiate between the encryption / MAC keys when using CBC-MAC. – Maarten Bodewes Mar 14 '15 at 21:13