internal XmlElement GetXml(XmlDocument document) { XmlElement cipherDataElement = document.CreateElement("CipherData", XmlNameSpace.Url[NS.XmlEncNamespaceUrl]); if (CipherValue != null) { XmlElement cipherValueElement = document.CreateElement("CipherValue", XmlNameSpace.Url[NS.XmlEncNamespaceUrl]); cipherValueElement.AppendChild(document.CreateTextNode(Convert.ToBase64String(CipherValue))); cipherDataElement.AppendChild(cipherValueElement); } else { if (CipherReference == null) { throw new System.Security.Cryptography.CryptographicException(SR.Cryptography_Xml_CipherValueElementRequired); } cipherDataElement.AppendChild(CipherReference.GetXml(document)); } return(cipherDataElement); }
internal XmlElement GetXml(XmlDocument document) { // Create the CipherData element XmlElement cipherDataElement = (XmlElement)document.CreateElement("CipherData", EncryptedXml.XmlEncNamespaceUrl); if (CipherValue != null) { XmlElement cipherValueElement = document.CreateElement("CipherValue", EncryptedXml.XmlEncNamespaceUrl); cipherValueElement.AppendChild(document.CreateTextNode(Convert.ToBase64String(CipherValue))); cipherDataElement.AppendChild(cipherValueElement); } else { // No CipherValue specified, see if there is a CipherReference if (CipherReference == null) { throw new System.Security.Cryptography.CryptographicException(SR.Cryptography_Xml_CipherValueElementRequired); } cipherDataElement.AppendChild(CipherReference.GetXml(document)); } return(cipherDataElement); }