mage encryption and decryption