Export to GitHub

crypto-js - issue #92

Add 8-bit CFB segment size support


Posted on Aug 24, 2013 by Happy Ox

What steps will reproduce the problem? 1. Encrypt data with OpenSSL, using 256-bit AES with 128-bit segment size, e.g.: openssl enc -e -aes-256-cfb -in <(echo -n plaintext) -out /dev/stdout -K 2c70e12b7a0646f92279f427c7b38e7334d8e5389cff167a1dc30e73f826b683 -iv 0123456789abcdef0123456789abcdef -base64

  1. Decrypt the ciphertext with CryptoJS var ciphertext = "ztVRBx6+mY/u"; var key = CryptoJS.enc.Hex.parse("2c70e12b7a0646f92279f427c7b38e7334d8e5389cff167a1dc30e73f826b683"); var iv = CryptoJS.enc.Hex.parse('0123456789abcdef0123456789abcdef'); var decrypted = CryptoJS.AES.decrypt(ciphertext, key, { mode: CryptoJS.mode.CFB, padding: CryptoJS.pad.NoPadding, iv: iv, }); var plaintext = decrypted.toString(CryptoJS.enc.Utf8);

  2. The above works. However, if you replace -aes-256-cfb (128 bit segment size) with -aes-256-cfb8 (8 bit segment size), the decryption fails.

CryptoJS should do one of the following: 1. Add support for 8 bit segment size. Some software libraries (e.g. PyCrypto) defaults to 8 bit segment size and their ciphertext can't be decrypted with CryptoJS.

  1. If 8 bit segment size support is not possible or desirable, please document that CryptoJS only supports 128 bit segment size. The documentation currently does not state that.

What version of the product are you using? On what operating system? CryptoJS v3.1.2 Ubuntu 12.04

Status: New

Labels:
Type-Defect Priority-Medium