/// <summary> /// Decrypts a XmlDocument representing a secure login credentials. /// </summary> /// <param name="encryptedDocument"> A XmlDocument type.</param> /// <returns> A decrypted secure login credentials.</returns> public static SecureLoginCredentials Load() { XmlDocument encryptedDocument = new XmlDocument(); encryptedDocument.Load(location); // add to new document XmlNode node = encryptedDocument.SelectSingleNode("//EncryptedData"); SecureLoginCredentials sec = null; SecureLoginCredentialsSerializer serializer = new SecureLoginCredentialsSerializer(); if ( node != null ) { XmlDocument document = new XmlDocument(); document.AppendChild(document.ImportNode(node,true)); // decrypt EncryptXml decrypt = new EncryptXml(document); decrypt.AddKeyNameMapping("slcreds", decrypt.GetMachineStoreKey("Ecyware.SecLogCreds")); decrypt.DecryptDocument(); sec = (SecureLoginCredentials)serializer.Create(document.DocumentElement.OuterXml); } return sec; }
/// <summary> /// Decrypts the body object. /// </summary> /// <param name="envelope"> The SoapEnvelope.</param> /// <returns> The XmlDocument with the decrypted Soap Body object.</returns> private XmlDocument Decrypt(XmlDocument encryptedDocument) { // add to new document XmlNode node = encryptedDocument.SelectSingleNode("//EncryptedData"); XmlDocument document = new XmlDocument(); document.AppendChild(document.ImportNode(node,true)); // decrypt EcyXmlEncryption.EncryptXml decrypt = new EcyXmlEncryption.EncryptXml(document); decrypt.AddKeyNameMapping("scriptingApplication", decrypt.GetMachineStoreKey("Ecyware.ScrAppEncryption")); decrypt.DecryptDocument(); return document; }
/// <summary> /// Decrypts a XmlDocument representing a scripting application. /// </summary> /// <param name="encryptedDocument"> A XmlDocument type.</param> /// <returns> A decrypted Scripting Application.</returns> public static ScriptingApplication Decrypt(XmlDocument encryptedDocument) { // add to new document XmlNode node = encryptedDocument.SelectSingleNode("//EncryptedData"); ScriptingApplication scrapp = null; ScriptingApplicationSerializer serializer = new ScriptingApplicationSerializer(); if ( node != null ) { XmlDocument document = new XmlDocument(); document.AppendChild(document.ImportNode(node,true)); // decrypt EncryptXml decrypt = new EncryptXml(document); decrypt.AddKeyNameMapping("scriptingApplication", decrypt.GetMachineStoreKey("Ecyware.ScrAppEncryption")); decrypt.DecryptDocument(); scrapp = (ScriptingApplication)serializer.Create(document.DocumentElement.OuterXml); } else { scrapp = (ScriptingApplication)serializer.Create(encryptedDocument.DocumentElement.OuterXml); } return scrapp; }