Fix decryption bug

A subtle bug that would cause index out of bounds exceptions because the
wrong variable was used for the array length.