Ejemplo n.º 1
0
 /// <summary>
 /// Creates a license validator with specified public key.
 /// </summary>
 /// <param name="publicKey">public key</param>
 protected AbstractLicenseValidator(string publicKey)
 {
     LeaseTimeout      = TimeSpan.FromMinutes(5);
     discoveryHost     = new DiscoveryHost();
     LicenseAttributes = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
     this.publicKey    = publicKey;
     discoveryHost.ClientDiscovered += DiscoveryHostOnClientDiscovered;
     sntpClient = new SntpClient(TimeServers);
 }
Ejemplo n.º 2
0
        private void ValidateUsingNetworkTime()
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                return;
            }

            var sntp = new SntpClient(TimeServers);

            sntp.BeginGetDate(time =>
            {
                if (time > ExpirationDate)
                {
                    RaiseLicenseInvalidated();
                }
            }
                              , () =>
            {
                /* ignored */
            });
        }
Ejemplo n.º 3
0
		private static void Main()
		{
			//Repro();

			var sntpClient = new SntpClient(new[]
			{
				"time.nist.gov",
				"time-nw.nist.gov",
				"time-a.nist.gov",
				"time-b.nist.gov",
				"time-a.timefreq.bldrdoc.gov",
				"time-b.timefreq.bldrdoc.gov",
				"time-c.timefreq.bldrdoc.gov",
				"utcnist.colorado.edu",
				"nist1.datum.com",
				"nist1.dc.certifiedtime.com",
				"nist1.nyc.certifiedtime.com",
			});

			Console.WriteLine(sntpClient.GetDateAsync().Result);
			Console.ReadLine();
		}
Ejemplo n.º 4
0
        private void ValidateUsingNetworkTime()
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                return;
            }

            var sntp = new SntpClient(TimeServers);

            sntp.GetDateAsync()
            .ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Logger.WarnException("Failed to get network time, can't tell if the OS time is accurate", task.Exception);
                    return;
                }
                if (task.Result > ExpirationDate)
                {
                    RaiseLicenseInvalidated();                             // will explicitly crash the system if event is not subscribed
                }
            });
        }
Ejemplo n.º 5
0
        private void ValidateUsingNetworkTime()
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                return;
            }

            if (LicenseType == LicenseType.Business ||
                LicenseType == LicenseType.Architect ||
                LicenseType == LicenseType.Education ||
                LicenseType == LicenseType.Enterprise ||
                LicenseType == LicenseType.Trial
                )
            {
                // Many organizations have blocked NTP traffic, so this
                // check creates additional noise that is cause for
                // concern on enterprise security teams.
                // Since the traffic is already blocked,
                // this check would not produce a desired result
                // anyway.
                return;
            }

            var sntp = new SntpClient(GetTimeServers());

            sntp.BeginGetDate(time =>
            {
                if (time > ExpirationDate)
                {
                    RaiseLicenseInvalidated();
                }
            },
                              () =>
            {
                /* ignored */
            });
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a license validator with specified public key.
 /// </summary>
 /// <param name="publicKey">public key</param>
 protected AbstractLicenseValidator(string publicKey)
 {
     LeaseTimeout = TimeSpan.FromMinutes(5);
     discoveryHost = new DiscoveryHost();
     LicenseAttributes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
     this.publicKey = publicKey;
     discoveryHost.ClientDiscovered += DiscoveryHostOnClientDiscovered;
     sntpClient = new SntpClient(TimeServers);
 }
Ejemplo n.º 7
0
        private void ValidateUsingNetworkTime()
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
                return;

            var sntp = new SntpClient(TimeServers);
            sntp.GetDateAsync()
                .ContinueWith(task =>
                {
                    if (task.IsFaulted)
                    {
                        Logger.WarnException("Failed to get network time, can't tell if the OS time is accurate", task.Exception);
                        return;
                    }
                    if (task.Result > ExpirationDate)
                        RaiseLicenseInvalidated(); // will explicitly crash the system if event is not subscribed
                });
        }
        private void ValidateUsingNetworkTime()
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
                return;

            var sntp = new SntpClient(TimeServers);
            sntp.BeginGetDate(time =>
            {
                if (time > ExpirationDate)
                    RaiseLicenseInvalidated();
            }
            , () =>
            {
                /* ignored */
            });
        }