encrypt and decrypt in msg