//It's possible CryptographicException can be thrown if the keys are changed. public string Decrypt(string content) { if (content == null) { throw new ArgumentNullException(nameof(content)); } using var aesObj = new AesGcmService(_key); return(aesObj.Decrypt(content)); }
//It's possible CryptographicException can be thrown if the keys are changed. public XElement Decrypt(XElement encryptedElement) { if (encryptedElement == null) { throw new ArgumentNullException(nameof(encryptedElement)); } using var aesObj = new AesGcmService(_key); return(XElement.Parse(aesObj.Decrypt(encryptedElement.Element("value")?.Value))); }