Handle nil and empty-string cases in the AES encryption provider