public Stream PreProcessGetTemplate(Stream stream)
        {
            MemoryStream result = new MemoryStream();

            SecureXml.DecryptXmlDocument(stream, result, this._certificate);
            result.Position = 0;

            return(result);
        }
        public Stream PostProcessSaveTemplate(Stream stream)
        {
            MemoryStream result = new MemoryStream();

            var namespaces = new Dictionary <string, string>
            {
                { "pnp", XMLConstants.PROVISIONING_SCHEMA_NAMESPACE_2016_05 }
            };

            SecureXml.EncryptXmlDocument(stream, result, "/pnp:Provisioning", namespaces, this._certificate);
            result.Position = 0;

            return(result);
        }