Fix key and iv length checking in the cipher stream