Пример #1
0
        public void RemotedExperienceService_Advertise(System.UInt32 Nonce, System.String HostId, System.String ApplicationId, System.String ApplicationVersion, System.String ApplicationData, System.String HostFriendlyName, System.String ExperienceFriendlyName, System.String ExperienceIconUri, System.String ExperienceEndpointUri, System.String ExperienceEndpointData, System.String SignatureAlgorithm, System.String Signature, System.String HostCertificate)
        {
            _RES_HostNonce              = BitConverter.GetBytes(Nonce);
            _RES_ApplicationId          = ApplicationId;
            _RES_ApplicationVersion     = ApplicationVersion;
            _RES_ExperienceEndpointUri  = ExperienceEndpointUri;
            _RES_ExperienceEndpointData = ExperienceEndpointData;
            _RES_SignatureAlgorithm     = SignatureAlgorithm;
            _RES_Signature              = Signature;
            _RES_HostCertificate        = HostCertificate;
            m_logger.LogDebug("RemotedExperienceService_Advertise(" + Nonce.ToString() + HostId.ToString() + ApplicationId.ToString() + ApplicationVersion.ToString() + ApplicationData.ToString() + HostFriendlyName.ToString() + ExperienceFriendlyName.ToString() + ExperienceIconUri.ToString() + ExperienceEndpointUri.ToString() + ExperienceEndpointData.ToString() + SignatureAlgorithm.ToString() + Signature.ToString() + HostCertificate.ToString() + ")");

            // parse endpoint data
            Dictionary <String, String> endpointData = new Dictionary <String, String>();

            foreach (String part in ExperienceEndpointData.Split(';'))
            {
                String[] nameValuePair = part.Split(new char[] { '=' }, 2);
                endpointData.Add(nameValuePair[0], nameValuePair[1]);
            }

            // decrypt MCX user password with cert's signing key (private key)
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

            rsa.FromXmlString(File.ReadAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Certificates\\SoftSledPrivateKey.xml"));

            byte[] cryptedPass = Convert.FromBase64String(endpointData["encryptedpassword"]);
            String rdpPass     = "";

            try
            {
                rdpPass = Encoding.ASCII.GetString(rsa.Decrypt(cryptedPass, true));
            }
            catch (Exception ex)
            {
                m_logger.LogError("RSA decryption of encrypted password failed " + ex.Message);
                m_logger.LogError("Extender Experience Pairing has failed!");
                return;
            }

            string rdpHost = ExperienceEndpointUri.Substring(6, ExperienceEndpointUri.Length - 12);
            string rdpUser = endpointData["user"];

            m_logger.LogDebug("RDP host: " + rdpHost);
            m_logger.LogDebug("RDP clear text Password: "******"RDP user: "******"Extender Experience data exchanged!");
        }
Пример #2
0
        /// <summary>
        /// Action: Advertise
        /// </summary>
        /// <param name="Nonce">Associated State Variable: A_ARG_TYPE_Nonce</param>
        /// <param name="HostId">Associated State Variable: A_ARG_TYPE_EndpointID</param>
        /// <param name="ApplicationId">Associated State Variable: A_ARG_TYPE_EndpointID</param>
        /// <param name="ApplicationVersion">Associated State Variable: A_ARG_TYPE_Version</param>
        /// <param name="ApplicationData">Associated State Variable: A_ARG_TYPE_AnyString</param>
        /// <param name="HostFriendlyName">Associated State Variable: A_ARG_TYPE_Name</param>
        /// <param name="ExperienceFriendlyName">Associated State Variable: A_ARG_TYPE_Name</param>
        /// <param name="ExperienceIconUri">Associated State Variable: A_ARG_TYPE_Uri</param>
        /// <param name="ExperienceEndpointUri">Associated State Variable: A_ARG_TYPE_Uri</param>
        /// <param name="ExperienceEndpointData">Associated State Variable: A_ARG_TYPE_AnyString</param>
        /// <param name="SignatureAlgorithm">Associated State Variable: A_ARG_TYPE_SignAlgorithm</param>
        /// <param name="Signature">Associated State Variable: A_ARG_TYPE_Signature</param>
        /// <param name="HostCertificate">Associated State Variable: A_ARG_TYPE_Certificate</param>
        public void Advertise(System.UInt32 Nonce, System.String HostId, System.String ApplicationId, System.String ApplicationVersion, System.String ApplicationData, System.String HostFriendlyName, System.String ExperienceFriendlyName, System.String ExperienceIconUri, System.String ExperienceEndpointUri, System.String ExperienceEndpointData, System.String SignatureAlgorithm, System.String Signature, System.String HostCertificate)
        {
            System.Diagnostics.Debug.WriteLine("RemotedExperienceService_Advertise(" + Nonce.ToString() + HostId.ToString() + ApplicationId.ToString() + ApplicationVersion.ToString() + ApplicationData.ToString() + HostFriendlyName.ToString() + ExperienceFriendlyName.ToString() + ExperienceIconUri.ToString() + ExperienceEndpointUri.ToString() + ExperienceEndpointData.ToString() + SignatureAlgorithm.ToString() + Signature.ToString() + HostCertificate.ToString() + ")");
            //ToDo: Add Your implementation here, and remove exception


            // Set the rdp login username/password in the config file.
            SoftSledConfig currConfig = SoftSledConfigManager.ReadConfig();

            currConfig.IsPaired         = true;
            currConfig.RdpLoginUserName = "******";
            currConfig.RdpLoginPassword = "******";
            SoftSledConfigManager.WriteConfig(currConfig);

            throw (new UPnPCustomException(800, "This method has not been completely implemented..."));
        }