Esempio n. 1
0
        public RequestEnvelope SetRequestEnvelopeUnknown6(RequestEnvelope requestEnvelope)
        {
            var rnd32 = new byte[32];
            var rnd   = new Random();

            rnd.NextBytes(rnd32);

            byte[] authSeed = requestEnvelope.AuthTicket != null?
                              requestEnvelope.AuthTicket.ToByteArray() :
                                  requestEnvelope.AuthInfo.ToByteArray();

            var sig = new Signature()
            {
                LocationHash1 =
                    Utils.GenerateLocation1(authSeed, requestEnvelope.Latitude, requestEnvelope.Longitude,
                                            requestEnvelope.Altitude),
                LocationHash2 =
                    Utils.GenerateLocation2(requestEnvelope.Latitude, requestEnvelope.Longitude,
                                            requestEnvelope.Altitude),
                Unk22               = ByteString.CopyFrom(rnd32),
                Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime(),
                TimestampSinceStart = (ulong)(DateTime.UtcNow.ToUnixTime() - _startTime.ToUnixTime())
            };

            foreach (var request in requestEnvelope.Requests)
            {
                sig.RequestHash.Add(
                    Utils.GenerateRequestHash(authSeed, request.ToByteArray())
                    );
            }

            requestEnvelope.Unknown6.Add(new Unknown6()
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2()
                {
                    Unknown1 = ByteString.CopyFrom(Crypt.Encrypt(sig.ToByteArray()))
                }
            });

            return(requestEnvelope);
        }
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var ticketBytes = _authTicket.ToByteArray();

            Signature.Types.DeviceInfo deviceInfo;
            if (settings.HardwareManufacturer.Equals("Apple", StringComparison.Ordinal))
            {
                // iOS
                deviceInfo = new Signature.Types.DeviceInfo()
                {
                    DeviceId             = settings.DeviceId,
                    DeviceBrand          = settings.DeviceBrand,
                    DeviceModel          = settings.DeviceModel,
                    DeviceModelBoot      = settings.DeviceModelBoot,
                    HardwareManufacturer = settings.HardwareManufacturer,
                    HardwareModel        = settings.HardwareModel,
                    FirmwareBrand        = settings.FirmwareBrand,
                    FirmwareType         = settings.FirmwareType,
                };
            }
            else
            {
                // Android
                deviceInfo = new Signature.Types.DeviceInfo()
                {
                    DeviceId              = settings.DeviceId,
                    AndroidBoardName      = settings.AndroidBoardName,
                    AndroidBootloader     = settings.AndroidBootloader,
                    DeviceBrand           = settings.DeviceBrand,
                    DeviceModel           = settings.DeviceModel,
                    DeviceModelIdentifier = settings.DeviceModelIdentifier,
                    DeviceModelBoot       = settings.DeviceModelBoot,
                    HardwareManufacturer  = settings.HardwareManufacturer,
                    HardwareModel         = settings.HardwareModel,
                    FirmwareBrand         = settings.FirmwareBrand,
                    FirmwareTags          = settings.FirmwareTags,
                    FirmwareType          = settings.FirmwareType,
                    FirmwareFingerprint   = settings.FirmwareFingerprint
                };
            }

            var sig = new Signature()
            {
                Timestamp           = (ulong)Utils.GetTime(true),
                TimestampSinceStart = (ulong)(Utils.GetTime(true) - _startTime),
                LocationHash1       = Utils.GenerateLocation1(ticketBytes, _latitude, _longitude, _altitude),
                LocationHash2       = Utils.GenerateLocation2(_latitude, _longitude, _altitude),
                SensorInfo          = new Signature.Types.SensorInfo()
                {
                    AccelNormalizedX  = GenRandom(-0.31110161542892456, 0.1681540310382843),
                    AccelNormalizedY  = GenRandom(-0.6574847102165222, -0.07290205359458923),
                    AccelNormalizedZ  = GenRandom(-0.9943905472755432, -0.7463029026985168),
                    TimestampSnapshot = (ulong)(Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 400)),
                    MagnetometerX     = GenRandom(-0.139084026217, 0.138112977147),
                    MagnetometerY     = GenRandom(-0.2, 0.19),
                    MagnetometerZ     = GenRandom(-0.2, 0.4),
                    AngleNormalizedX  = GenRandom(-47.149471283, 61.8397789001),
                    AngleNormalizedY  = GenRandom(-47.149471283, 61.8397789001),
                    AngleNormalizedZ  = GenRandom(-47.149471283, 5),
                    AccelRawX         = GenRandom(0.0729667818829, 0.0729667818829),
                    AccelRawY         = GenRandom(-2.788630499244109, 3.0586791383810468),
                    AccelRawZ         = GenRandom(-0.34825887123552773, 0.19347580173737935),
                    GyroscopeRawX     = GenRandom(-0.9703824520111084, 0.8556089401245117),
                    GyroscopeRawY     = GenRandom(-1.7470258474349976, 1.4218578338623047),
                    GyroscopeRawZ     = GenRandom(-0.9681901931762695, 0.8396636843681335),
                    AccelerometerAxes = 3
                },
                DeviceInfo = deviceInfo
            };

            sig.LocationFix.Add(new Signature.Types.LocationFix()
            {
                Provider           = "fused",
                Latitude           = (float)_latitude,
                Longitude          = (float)_longitude,
                Altitude           = (float)_altitude,
                HorizontalAccuracy = (float)Math.Round(GenRandom(50, 250), 7),
                VerticalAccuracy   = RandomDevice.Next(2, 5),
                TimestampSnapshot  = (ulong)(Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 300)),
                ProviderStatus     = 3,
                LocationType       = 1
            });

            foreach (var request in requests)
            {
                sig.RequestHash.Add(Utils.GenerateRequestHash(ticketBytes, request.ToByteArray()));
            }

            sig.SessionHash = SessionHash;
            //sig.Unknown25 = -8537042734809897855; // For 0.33
            sig.Unknown25 = 7363665268261373700; // For 0.35

            Unknown6 val = new Unknown6()
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2()
                {
                    EncryptedSignature = ByteString.CopyFrom(crypt.Encrypt(sig.ToByteArray()))
                }
            };

            return(val);
        }
Esempio n. 3
0
        public RequestEnvelope SetRequestEnvelopeUnknown6(RequestEnvelope requestEnvelope)
        {
            if (_sessionHash == null)
            {
                _sessionHash = new byte[32];
                _random.NextBytes(_sessionHash);
            }

            byte[] authSeed = requestEnvelope.AuthTicket != null?
                              requestEnvelope.AuthTicket.ToByteArray() :
                                  requestEnvelope.AuthInfo.ToByteArray();


            var normAccel = new Vector(_deviceInfo.AccelRawX, _deviceInfo.AccelRawY, _deviceInfo.AccelRawZ);

            normAccel.NormalizeVector(9.81);
            normAccel.Round(2);

            ulong timeFromStart = (ulong)_deviceInfo.TimeSnapshot.TotalMilliseconds;

            var sig = new Signature
            {
                LocationHash1 =
                    Utils.GenerateLocation1(authSeed, requestEnvelope.Latitude, requestEnvelope.Longitude,
                                            requestEnvelope.Altitude),
                LocationHash2 =
                    Utils.GenerateLocation2(requestEnvelope.Latitude, requestEnvelope.Longitude,
                                            requestEnvelope.Altitude),
                SessionHash         = ByteString.CopyFrom(_sessionHash),
                Unknown25           = -8537042734809897855L,
                Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime(),
                TimestampSinceStart = timeFromStart,
                SensorInfo          = new Signature.Types.SensorInfo
                {
                    AccelNormalizedX  = normAccel.X,
                    AccelNormalizedY  = normAccel.Y,
                    AccelNormalizedZ  = normAccel.Z,
                    AccelRawX         = -_deviceInfo.AccelRawX,
                    AccelRawY         = -_deviceInfo.AccelRawY,
                    AccelRawZ         = -_deviceInfo.AccelRawZ,
                    MagnetometerX     = _deviceInfo.MagnetometerX,
                    MagnetometerY     = _deviceInfo.MagnetometerY,
                    MagnetometerZ     = _deviceInfo.MagnetometerZ,
                    GyroscopeRawX     = _deviceInfo.GyroscopeRawX,
                    GyroscopeRawY     = _deviceInfo.GyroscopeRawY,
                    GyroscopeRawZ     = _deviceInfo.GyroscopeRawZ,
                    AngleNormalizedX  = _deviceInfo.AngleNormalizedX,
                    AngleNormalizedY  = _deviceInfo.AngleNormalizedY,
                    AngleNormalizedZ  = _deviceInfo.AngleNormalizedZ,
                    AccelerometerAxes = _deviceInfo.AccelerometerAxes,
                    TimestampSnapshot = timeFromStart - (ulong)_random.Next(150, 260)
                },
                DeviceInfo = new Signature.Types.DeviceInfo
                {
                    DeviceId      = _deviceInfo.DeviceID,
                    FirmwareBrand = _deviceInfo.FirmwareBrand,
                    FirmwareType  = _deviceInfo.FirmwareType
                }

                /*ActivityStatus = new Signature.Types.ActivityStatus()
                 * {
                 *  StartTimeMs = timeFromStart - (ulong)_random.Next(150, 350),
                 *  Walking = false,
                 *  Automotive = false,
                 *  Cycling = false,
                 *  Running = false,
                 *  Stationary = true,
                 *  Tilting = false,
                 *  UnknownStatus = false,
                 *  Status = ByteString.Empty //Have no idea what is there
                 * }*/
            };

            _deviceInfo.LocationFixes.ToList().ForEach(loc => sig.LocationFix.Add(new Signature.Types.LocationFix
            {
                Floor              = loc.Floor,
                Longitude          = loc.Longitude,
                Latitude           = loc.Latitude,
                Altitude           = loc.Altitude,
                LocationType       = loc.LocationType,
                Provider           = loc.Provider,
                ProviderStatus     = loc.ProviderStatus,
                HorizontalAccuracy = loc.HorizontalAccuracy,
                VerticalAccuracy   = loc.VerticalAccuracy,
                TimestampSnapshot  = loc.Timestamp
            }));

            foreach (var request in requestEnvelope.Requests)
            {
                sig.RequestHash.Add(
                    Utils.GenerateRequestHash(authSeed, request.ToByteArray())
                    );
            }

            requestEnvelope.Unknown6 = new Unknown6
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2
                {
                    EncryptedSignature = ByteString.CopyFrom(Crypt.Encrypt(sig.ToByteArray()))
                }
            };

            return(requestEnvelope);
        }
Esempio n. 4
0
        public RequestEnvelope SetRequestEnvelopeUnknown6(RequestEnvelope requestEnvelope)
        {
            if (_sessionHash == null)
            {
                _sessionHash = new byte[32];
                _random.NextBytes(_sessionHash);
            }

            byte[] authSeed = requestEnvelope.AuthTicket != null?
                              requestEnvelope.AuthTicket.ToByteArray() :
                                  requestEnvelope.AuthInfo.ToByteArray();


            var normAccel = new Vector(_deviceInfo.Sensors.AccelRawX, _deviceInfo.Sensors.AccelRawY, _deviceInfo.Sensors.AccelRawZ);

            normAccel.NormalizeVector(1.0f);//1.0f on iOS, 9.81 on Android?

            var sig = new Signature
            {
                LocationHash1 =
                    Utils.GenerateLocation1(authSeed, requestEnvelope.Latitude, requestEnvelope.Longitude,
                                            requestEnvelope.Altitude),
                LocationHash2 =
                    Utils.GenerateLocation2(requestEnvelope.Latitude, requestEnvelope.Longitude,
                                            requestEnvelope.Altitude),
                SessionHash         = ByteString.CopyFrom(_sessionHash),
                Unknown25           = 7363665268261373700L,
                Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime(),
                TimestampSinceStart = (ulong)_deviceInfo.TimeSnapshot,
                SensorInfo          = new Signature.Types.SensorInfo
                {
                    AccelNormalizedX  = normAccel.X,
                    AccelNormalizedY  = normAccel.Y,
                    AccelNormalizedZ  = normAccel.Z,
                    AccelRawX         = -_deviceInfo.Sensors.AccelRawX,
                    AccelRawY         = -_deviceInfo.Sensors.AccelRawY,
                    AccelRawZ         = -_deviceInfo.Sensors.AccelRawZ,
                    MagnetometerX     = _deviceInfo.Sensors.MagnetometerX,
                    MagnetometerY     = _deviceInfo.Sensors.MagnetometerY,
                    MagnetometerZ     = _deviceInfo.Sensors.MagnetometerZ,
                    GyroscopeRawX     = _deviceInfo.Sensors.GyroscopeRawX,
                    GyroscopeRawY     = _deviceInfo.Sensors.GyroscopeRawY,
                    GyroscopeRawZ     = _deviceInfo.Sensors.GyroscopeRawZ,
                    AngleNormalizedX  = _deviceInfo.Sensors.AngleNormalizedX,
                    AngleNormalizedY  = _deviceInfo.Sensors.AngleNormalizedY,
                    AngleNormalizedZ  = _deviceInfo.Sensors.AngleNormalizedZ,
                    AccelerometerAxes = _deviceInfo.Sensors.AccelerometerAxes,
                    TimestampSnapshot = (ulong)(_deviceInfo.Sensors.TimeSnapshot - _random.Next(150, 260))
                },
                DeviceInfo = new Signature.Types.DeviceInfo
                {
                    DeviceId              = _deviceInfo.DeviceID,
                    AndroidBoardName      = _deviceInfo.AndroidBoardName,
                    AndroidBootloader     = _deviceInfo.AndroidBootloader,
                    DeviceBrand           = _deviceInfo.DeviceBrand,
                    DeviceModel           = _deviceInfo.DeviceModel,
                    DeviceModelBoot       = _deviceInfo.DeviceModelBoot,
                    DeviceModelIdentifier = _deviceInfo.DeviceModelIdentifier,
                    FirmwareFingerprint   = _deviceInfo.FirmwareFingerprint,
                    FirmwareTags          = _deviceInfo.FirmwareTags,
                    HardwareManufacturer  = _deviceInfo.HardwareManufacturer,
                    HardwareModel         = _deviceInfo.HardwareModel,
                    FirmwareBrand         = _deviceInfo.FirmwareBrand,
                    FirmwareType          = _deviceInfo.FirmwareType
                },

                ActivityStatus = _deviceInfo.ActivityStatus != null ? new Signature.Types.ActivityStatus()
                {
                    Walking    = _deviceInfo.ActivityStatus.Walking,
                    Automotive = _deviceInfo.ActivityStatus.Automotive,
                    Cycling    = _deviceInfo.ActivityStatus.Cycling,
                    Running    = _deviceInfo.ActivityStatus.Running,
                    Stationary = _deviceInfo.ActivityStatus.Stationary,
                    Tilting    = _deviceInfo.ActivityStatus.Tilting,
                }
                : null
            };


            if (_deviceInfo.GpsSattelitesInfo.Length > 0)
            {
                sig.GpsInfo = new Signature.Types.AndroidGpsInfo();
                //sig.GpsInfo.TimeToFix //currently not filled

                _deviceInfo.GpsSattelitesInfo.ToList().ForEach(sat =>
                {
                    sig.GpsInfo.Azimuth.Add(sat.Azimuth);
                    sig.GpsInfo.Elevation.Add(sat.Elevation);
                    sig.GpsInfo.HasAlmanac.Add(sat.Almanac);
                    sig.GpsInfo.HasEphemeris.Add(sat.Emphasis);
                    sig.GpsInfo.SatellitesPrn.Add(sat.SattelitesPrn);
                    sig.GpsInfo.Snr.Add(sat.Snr);
                    sig.GpsInfo.UsedInFix.Add(sat.UsedInFix);
                });
            }

            _deviceInfo.LocationFixes.ToList().ForEach(loc => sig.LocationFix.Add(new Signature.Types.LocationFix
            {
                Floor     = loc.Floor,
                Longitude = loc.Longitude,
                Latitude  = loc.Latitude,
                //Altitude = loc.Altitude, //currently probably not filled
                LocationType       = loc.LocationType,
                Provider           = loc.Provider,
                ProviderStatus     = loc.ProviderStatus,
                HorizontalAccuracy = loc.HorizontalAccuracy,
                VerticalAccuracy   = loc.VerticalAccuracy,
                Unknown20          = loc.Unknown20,
                TimestampSnapshot  = loc.TimeSnapshot
            }));

            foreach (var request in requestEnvelope.Requests)
            {
                sig.RequestHash.Add(
                    Utils.GenerateRequestHash(authSeed, request.ToByteArray())
                    );
            }

            requestEnvelope.Unknown6 = new Unknown6
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2
                {
                    EncryptedSignature = ByteString.CopyFrom(Crypt.Encrypt(sig.ToByteArray()))
                }
            };

            return(requestEnvelope);
        }
Esempio n. 5
0
        public RequestEnvelope SetRequestEnvelopeUnknown6(RequestEnvelope requestEnvelope)
        {
            var rnd32 = new byte[32];
            var rnd   = new Random();

            rnd.NextBytes(rnd32);

            var ticketBytes = requestEnvelope.AuthTicket.ToByteArray();

            var sig = new Signature()
            {
                LocationHash1 = Utils.GenerateLocation1(ticketBytes, requestEnvelope.Latitude, requestEnvelope.Longitude,
                                                        requestEnvelope.Altitude),
                LocationHash2 =
                    Utils.GenerateLocation2(requestEnvelope.Latitude, requestEnvelope.Longitude,
                                            requestEnvelope.Altitude),

                //Unknown25 = -8537042734809897855,
                Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime(),
                TimestampSinceStart = (ulong)(DateTime.UtcNow.ToUnixTime() - _startTime.ToUnixTime()),
                SensorInfo          = new Signature.Types.SensorInfo()
                {
                    AccelNormalizedZ  = GenRandom(9.8),
                    AccelNormalizedX  = GenRandom(0.02),
                    AccelNormalizedY  = GenRandom(0.3),
                    TimestampSnapshot = (ulong)_internalWatch.ElapsedMilliseconds - 230,
                    MagnetometerX     = GenRandom(0.12271042913198471),
                    MagnetometerY     = GenRandom(-0.015570580959320068),
                    MagnetometerZ     = GenRandom(0.010850906372070313),
                    AngleNormalizedX  = GenRandom(17.950439453125),
                    AngleNormalizedY  = GenRandom(-23.36273193359375),
                    AngleNormalizedZ  = GenRandom(-48.8250732421875),
                    AccelRawX         = GenRandom(-0.0120010357350111),
                    AccelRawY         = GenRandom(-0.04214850440621376),
                    AccelRawZ         = GenRandom(0.94571763277053833),
                    GyroscopeRawX     = GenRandom(7.62939453125e-005),
                    GyroscopeRawY     = GenRandom(-0.00054931640625),
                    GyroscopeRawZ     = GenRandom(0.0024566650390625),
                    AccelerometerAxes = 3
                },
                DeviceInfo = GetDeviceInfo()
            };



            //sig.DeviceInfo = _client.DeviceInfo;
            sig.LocationFix.Add(new Signature.Types.LocationFix()
            {
                Provider = "network",

                //Unk4 = 120,
                Latitude  = (float)_client.CurrentLatitude,
                Longitude = (float)_client.CurrentLongitude,
                Altitude  = (float)_client.CurrentAltitude,
                //TimestampSinceStart = (ulong)_internalWatch.ElapsedMilliseconds - 200,
                TimestampSnapshot = (ulong)_internalWatch.ElapsedMilliseconds - 200,
                Floor             = 3,
                LocationType      = 1,
                ProviderStatus    = 3
            });

            sig.SessionHash = ByteString.CopyFrom(_client.SessionHash);
            sig.Unknown25   = BitConverter.ToUInt32(new System.Data.HashFunction.xxHash(64, 0x88533787).ComputeHash(System.Text.Encoding.ASCII.GetBytes("\"b8fa9757195897aae92c53dbcf8a60fb3d86d745\"")), 0);

            foreach (var request in requestEnvelope.Requests)
            {
                sig.RequestHash.Add(
                    Utils.GenerateRequestHash(ticketBytes, request.ToByteArray())
                    );
            }

            requestEnvelope.Unknown6.Add(new Unknown6()
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2()
                {
                    EncryptedSignature = ByteString.CopyFrom(Crypt.Encrypt(sig.ToByteArray()))
                }
            });

            return(requestEnvelope);
        }
        private RequestEnvelope.Types.PlatformRequest GenerateSignature(IEnumerable <IMessage> requests)
        {
            var ticketBytes = _authTicket.ToByteArray();

            // Common device info
            Signature.Types.DeviceInfo deviceInfo = new Signature.Types.DeviceInfo
            {
                DeviceId             = _settings.DeviceId,
                DeviceBrand          = _settings.DeviceBrand,
                DeviceModel          = _settings.DeviceModel,
                DeviceModelBoot      = _settings.DeviceModelBoot,
                HardwareManufacturer = _settings.HardwareManufacturer,
                HardwareModel        = _settings.HardwareModel,
                FirmwareBrand        = _settings.FirmwareBrand,
                FirmwareType         = _settings.FirmwareType
            };

            // Android
            if (_client.Platform == Platform.Android)
            {
                deviceInfo.AndroidBoardName      = _settings.AndroidBoardName;
                deviceInfo.AndroidBootloader     = _settings.AndroidBootloader;
                deviceInfo.DeviceModelIdentifier = _settings.DeviceModelIdentifier;
                deviceInfo.FirmwareTags          = _settings.FirmwareTags;
                deviceInfo.FirmwareFingerprint   = _settings.FirmwareFingerprint;
            }

            var sig = new Signature
            {
                SessionHash         = SessionHash,
                Unknown25           = Client_3500_Unknown25,
                Timestamp           = (ulong)Utils.GetTime(true),
                TimestampSinceStart = (ulong)(Utils.GetTime(true) - _client.StartTime),
                LocationHash1       = Utils.GenerateLocation1(ticketBytes, _latitude, _longitude, _horizontalAccuracy),
                LocationHash2       = Utils.GenerateLocation2(_latitude, _longitude, _horizontalAccuracy),
                SensorInfo          = new Signature.Types.SensorInfo
                {
                    TimestampSnapshot   = (ulong)(Utils.GetTime(true) - _client.StartTime - RandomDevice.Next(100, 500)),
                    LinearAccelerationX = TRandomDevice.Triangular(-3, 1, 0),
                    LinearAccelerationY = TRandomDevice.Triangular(-2, 3, 0),
                    LinearAccelerationZ = TRandomDevice.Triangular(-4, 2, 0),
                    MagneticFieldX      = TRandomDevice.Triangular(-50, 50, 0),
                    MagneticFieldY      = TRandomDevice.Triangular(-60, 50, -5),
                    MagneticFieldZ      = TRandomDevice.Triangular(-60, 40, -30),
                    RotationVectorX     = GenRandom(-47.149471283, 61.8397789001),
                    RotationVectorY     = GenRandom(-47.149471283, 61.8397789001),
                    RotationVectorZ     = GenRandom(-47.149471283, 5),
                    GyroscopeRawX       = GenRandom(0.0729667818829, 0.0729667818829),
                    GyroscopeRawY       = GenRandom(-2.788630499244109, 3.0586791383810468),
                    GyroscopeRawZ       = GenRandom(-0.34825887123552773, 0.19347580173737935),
                    GravityX            = TRandomDevice.Triangular(-1, 1, 0.15),
                    GravityY            = TRandomDevice.Triangular(-1, 1, -.2),
                    GravityZ            = TRandomDevice.Triangular(-1, .7, -0.8),
                    AccelerometerAxes   = 3
                },
                DeviceInfo = deviceInfo
            };

            Signature.Types.LocationFix locationFix = new Signature.Types.LocationFix
            {
                Provider           = TRandomDevice.Choice(new List <string>(new string[] { "network", "network", "network", "network", "fused" })),
                Latitude           = (float)_latitude,
                Longitude          = (float)_longitude,
                Altitude           = (float)_altitude,
                HorizontalAccuracy = (float)_horizontalAccuracy,
                TimestampSnapshot  = (ulong)(Utils.GetTime(true) - _client.StartTime - RandomDevice.Next(100, 300)),
                ProviderStatus     = 3,
                LocationType       = 1
            };

            if (_horizontalAccuracy >= 65)
            {
                locationFix.HorizontalAccuracy = (float)TRandomDevice.Choice(new List <double>(new double[] { _horizontalAccuracy, 65, 65, GenRandom(66, 80), 200 }));
                if (_client.Platform == Platform.Ios)
                {
                    locationFix.VerticalAccuracy = (float)TRandomDevice.Triangular(35, 100, 65);
                }
            }
            else
            {
                locationFix.HorizontalAccuracy = (float)_horizontalAccuracy;
                if (_client.Platform == Platform.Ios)
                {
                    if (_horizontalAccuracy > 10)
                    {
                        locationFix.VerticalAccuracy = (float)TRandomDevice.Choice(new List <double>(new double[] { 24, 32, 48, 48, 64, 64, 96, 128 }));
                    }
                    else
                    {
                        locationFix.VerticalAccuracy = (float)TRandomDevice.Choice(new List <double>(new double[] { 3, 4, 6, 6, 8, 12, 24 }));
                    }
                }
            }

            if (_client.Platform == Platform.Ios)
            {
                if (RandomDevice.NextDouble() > 0.95)
                {
                    // No reading for roughly 1 in 20 updates
                    locationFix.Course = -1;
                    locationFix.Speed  = -1;
                }
                else
                {
                    _course = (float)TRandomDevice.Triangular(0, 360, _course);

                    // Course is iOS only.
                    locationFix.Course = _course;

                    // Speed is iOS only.
                    locationFix.Speed = _speed;
                }
            }

            sig.LocationFix.Add(locationFix);

            foreach (var request in requests)
            {
                sig.RequestHash.Add(Utils.GenerateRequestHash(ticketBytes, request.ToByteArray()));
            }

            var encryptedSignature = new RequestEnvelope.Types.PlatformRequest
            {
                Type           = PlatformRequestType.SendEncryptedSignature,
                RequestMessage = new SendEncryptedSignatureRequest
                {
                    EncryptedSignature = ByteString.CopyFrom(_crypt.Encrypt(sig.ToByteArray()))
                }.ToByteString()
            };

            return(encryptedSignature);
        }