Added function to encrypt and decrypt using I/O channel