support for decrypting mode
merge encrypt branch