Example #1
0
        /// <summary>
        ///     A check to see if
        /// </summary>
        private void PerformStartupCheck()
        {
            var version   = _version.ToString();
            var challenge = DateTime.Now.ToString(CultureInfo.InvariantCulture);
            var signature = Certs.SignData(_email, _licenseKey, version, challenge);

            try
            {
                StartupResponseV1 response;
                using (var client = new LicenseV1Client(new BasicHttpBinding(), new EndpointAddress(_licenseServer)))
                    response = client.Startup(_email, _licenseKey, version, challenge, signature);

                if (!Certs.VerifyData(response.Signature, response.InstanceId, response.Email, response.LicenseKey, response.ActiveInstances, response.SupportInstances, response.Challenge))
                {
                    throw new Exception();
                }

                _instanceId       = response.InstanceId;
                _activeInstances  = response.ActiveInstances;
                _supportInstances = response.SupportInstances;
            }
            catch (FaultException <LicenseFault> exception)
            {
                throw new SecurityException(exception.Detail.Fault);
            }
            catch (Exception)
            {
                throw new SecurityException(_verifyError);
            }
        }
Example #2
0
        /// <summary>
        ///     This tells the server the directeve instance has been closed
        /// </summary>
        internal void QuitDirectEve()
        {
            // Fire & forget
            try
            {
                var challenge = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                var signature = Certs.SignData(_email, _licenseKey, _instanceId, challenge);

                using (var client = new LicenseV1Client(new BasicHttpBinding(), new EndpointAddress(_licenseServer)))
                    client.Shutdown(_email, _licenseKey, _instanceId, challenge, signature);
            }
            catch
            {
            }
        }
Example #3
0
        /// <summary>
        ///     This pulses the server to keep it alive
        /// </summary>
        private void PulseThread()
        {
            try
            {
                var challenge = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                var signature = Certs.SignData(_email, _licenseKey, _instanceId, challenge);

                UpdateResponseV1 response;
                using (var client = new LicenseV1Client(new BasicHttpBinding(), new EndpointAddress(_licenseServer)))
                    response = client.KeepAlive(_email, _licenseKey, _instanceId, challenge, signature);

                _pulseResult = Certs.VerifyData(response.Signature, response.InstanceId, response.Challenge);
            }
            catch (Exception)
            {
                // An exception is not good :)
                _pulseResult = false;
            }
        }
Example #4
0
        /// <summary>
        ///     This pulses the server to keep it alive
        /// </summary>
        private void PulseThread()
        {
            try
            {
                var challenge = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                var signature = Certs.SignData(_email, _licenseKey, _instanceId, challenge);

                UpdateResponseV1 response;
                using (var client = new LicenseV1Client(new BasicHttpBinding(), new EndpointAddress(_licenseServer)))
                    response = client.KeepAlive(_email, _licenseKey, _instanceId, challenge, signature);

                _pulseResult = Certs.VerifyData(response.Signature, response.InstanceId, response.Challenge);
            }
            catch (Exception)
            {
                // An exception is not good :)
                _pulseResult = false;
            }
        }
Example #5
0
        /// <summary>
        ///     A check to see if
        /// </summary>
        private void PerformStartupCheck()
        {
            var version = _version.ToString();
            var challenge = DateTime.Now.ToString(CultureInfo.InvariantCulture);
            var signature = Certs.SignData(_email, _licenseKey, version, challenge);

            try
            {
                StartupResponseV1 response;
                using (var client = new LicenseV1Client(new BasicHttpBinding(), new EndpointAddress(_licenseServer)))
                    response = client.Startup(_email, _licenseKey, version, challenge, signature);

                if (!Certs.VerifyData(response.Signature, response.InstanceId, response.Email, response.LicenseKey, response.ActiveInstances, response.SupportInstances, response.Challenge))
                    throw new Exception();

                _instanceId = response.InstanceId;
                _activeInstances = response.ActiveInstances;
                _supportInstances = response.SupportInstances;
            }
            catch (FaultException<LicenseFault> exception)
            {
                throw new SecurityException(exception.Detail.Fault);
            }
            catch (Exception)
            {
                throw new SecurityException(_verifyError);
            }
        }
Example #6
0
        /// <summary>
        ///     This tells the server the directeve instance has been closed
        /// </summary>
        internal void QuitDirectEve()
        {
            // Fire & forget
            try
            {
                var challenge = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                var signature = Certs.SignData(_email, _licenseKey, _instanceId, challenge);

                using (var client = new LicenseV1Client(new BasicHttpBinding(), new EndpointAddress(_licenseServer)))
                    client.Shutdown(_email, _licenseKey, _instanceId, challenge, signature);
            }
            catch
            {
            }
        }