public string Encrypt(string content) { if (content == null) { throw new ArgumentNullException(nameof(content)); } using var aesObj = new AesGcmService(_key); return(aesObj.Encrypt(content)); }
public EncryptedXmlInfo Encrypt(XElement plaintextElement) { if (plaintextElement == null) { throw new ArgumentNullException(nameof(plaintextElement)); } using var aesObj = new AesGcmService(_key); var element = new XElement("encryptedKey", new XComment(" This key is encrypted with AES-256-GCM. "), new XElement("value", aesObj.Encrypt(plaintextElement.ToString()))); return(new EncryptedXmlInfo(element, typeof(AesGcmXmlDecryptor))); }