public static bool TryExtractDecryptionCertificateSKIFromEncryptedXml(string encryptedData, out string requiredCertificateSKI, out Exception exception) { RmsUtil.ThrowIfParameterNull(encryptedData, "encryptedData"); requiredCertificateSKI = null; exception = null; try { XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.LoadXml(encryptedData); using (XmlNodeList elementsByTagName = xmlDocument.GetElementsByTagName("X509SKI")) { if (elementsByTagName.Count > 0) { byte[] value = Convert.FromBase64String(elementsByTagName[0].InnerText); requiredCertificateSKI = BitConverter.ToString(value); return(true); } } exception = new XmlException("X509SKI node not found in encrypted XML document"); } catch (FormatException ex) { exception = ex; } catch (XmlException ex2) { exception = ex2; } return(false); }
internal static string RetrieveCodesInPostAndPreActions(string workflowName, string xaml, string codeBehind) { XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.LoadXml(xaml); string result; using (XmlNodeList elementsByTagName = xmlDocument.GetElementsByTagName(workflowName)) { List <string> functionNames = DDIVUtil.RetrievePostAndPreActions(elementsByTagName[0]); result = DDIVUtil.RetrieveCodeFunctions(codeBehind, functionNames); } return(result); }