# SAM-PAY: A Location-Based Authentication Method for Mobile Environments +
## 4 Design of the SAM-PAY Authentication Method
### Modified LDEA Geo-Encryption Algorithm  
The term \"geo-encryption\" or \"location-based encryption\" refers to a security algorithm that limits the access or decryption of some information content to specified locations and/or times [64; 65]. The algorithm does not replace any of the conventional cryptographic algorithms, but it adds instead an additional security layer. By using a geo-encryption algorithm, the sender can restrict the location of the receiver for data decryption. Several geo-encryption algorithms have been proposed so far, such as [64]. Some of them are public, whereas others are protected by patents. One public geo-encryption algorithm is the location-dependent data-encryption algorithm (LDEA) published in [66], then in [67] and also used in [68] to enhance the security of a mobile information system by allowing the mobile clients to transmit a target latitude/longitude coordinate for data encryption to the information server. The client can only decrypt the ciphertext when the coordinate acquired from the GPS receiver matches with the target coordinate.  
LDEA uses latitude/longitude coordinates to derive a key called LDEA-key, which is further combined (using an XOR operation) with a random session key to calculate the Final-key. This key is used to encrypt the plaintext data. When a target coordinate is determined for data encryption, the ciphertext can only be decrypted at the expected location. The LDEA algorithm uses public-key cryptography to ensure the authenticity and integrity of the session key.  
In our approach, we retained from the LDEA algorithm [67] the technique used to derive the LDEA-key. For example, in Figure 3, E 12134.5971 means 121\({}^{\circ}\) and 34.5971 min east longitude. N 2504.7314 means 25\({}^{\circ}\) and 4.7314 min north latitude. Combine and hash means that the results of transforming the latitue/longitude coordinates into an integer part are further combined by performing a bitwise exclusive-OR operation. Then, a hash algorithm is utilized (note: MD5 was used in the original LDEA algorithm, but nowadays MD5 algorithm is considered obsolete and algorithms from SHA2 family are appropriate, such as SHA-256) to generate a digest for the combined result. If the digest is 256-bit long, the digest is split into two 128-bit values, called LDEA-keys. Additionally, we used a symmetric key (named \(KS_{e}\)) to generate the Final-key [23], which is composed of a 128-bit key (that can be used with the AES algorithm) and an 128-bit initialization vector (IV). The latter key (and IV) are used by the SP to encrypt the OTC with a symmetric algorithm (like AES-128 in CBC mode), obtaining thus the TOKEN that will be sent to the user (as shown in Figure 4). The resulting scheme is shown in Figure 4. Since the OTC is changed at each session, it is not necessary to use a random session key to protect the TOKEN from dictionary attacks. The resulting TOKEN, obtained by encrypting the OTC with the AES algorithm and the Final-key, will be different at each session. Since the position determined by the GPS receiver of the UT terminal could be inaccurate and inconsistent depending on how many satellite signals are received, the LDEA algorithm uses an additional parameter named Toleration Distance (TD), which must be known both by the sender and the receiver. The sender uses the TD (e.g., 0, 5, 10, 15, or 20 m) when calculating the LDEA-key, and the receiver can recover the OTC if it is within the TD range.