[FEATURE] Error checking for encrypt and decrypt