Physical Layer: Implement Encryption or Jamming-Resistant Modulation Technique

Data Security at the Physical Layer: A Case Study

To study the impact of jamming on secure communication, I will explore the following techniques:

  1. Basic Encryption: Simple XOR encryption was used to demonstrate the concept of physical layer security.
  2. Jamming Simulation: A specific frequency band was targeted for jamming, mimicking real-world interference scenarios.
  3. Frequency Hopping: To counteract jamming, the transmission frequency was dynamically changed.
  4. Advanced Encryption: AES-128 encryption was employed to enhance the security of the transmitted data.
  5. Modulation: QAM modulation was used to map digital data onto analog signals for transmission.
  6. Layered Encryption: A layered approach combining symmetric and asymmetric encryption was investigated to provide robust security.
  7. Adaptive Modulation: The modulation scheme was dynamically adjusted to optimize performance based on channel conditions.
  8. Error Correction: Hamming codes were used to introduce redundancy into the data and improve error resilience.
  9. Jamming Detection: Techniques for detecting jamming based on changes in SNR were implemented to trigger adaptive countermeasures.

At the physical layer of the communication model, the primary objective is to guarantee the confidentiality of transmitted data. This is typically achieved through encryption, a process that transforms plaintext into ciphertext, rendering it unintelligible to unauthorized parties. One common encryption method applied before modulation is XOR encryption.


1. XOR Encryption: A Simple Yet Effective Technique

XOR encryption involves the bitwise XOR operation between the plaintext and a key. The result is the ciphertext. The beauty of XOR lies in its reversibility; the same key can be used to decrypt the ciphertext back into the original plaintext.

XOR encryption is a simple yet effective encryption mechanism used to obfuscate data. The XOR operation has the property that applying it twice with the same key restores the original data.

  • Encryption:

    encrypted_message[i]=plaintext[i]key[i]

    where ⊕ represents the XOR operation.

  • Decryption:

    decrypted_message[i]=received_signal[i]key[i]

    XORing the encrypted message again with the same key retrieves the original message.


2. Simulating Jamming

The jammer blocks the signal at specific time steps if the frequency is 2.45 GHz. The result is a jammed signal that is transmitted over the network. The transmitted signal is either the encrypted data (if not jammed) or zero (if jammed).


3. Frequency Hopping: A Defense Against Jamming

To further enhance security and resilience against interference, frequency hopping can be employed in conjunction with encryption. In frequency hopping, the transmitter rapidly switches between different frequencies, making it difficult for an attacker to jam the entire transmission.

Frequency hopping is a method used in wireless communication to spread a signal over multiple frequency channels to resist interference or jamming. The transmitter rapidly switches the carrier frequency among different frequencies in a known pattern.

  1. Frequencies and Hopping Pattern:

    • Three frequency options: 2.4 GHz, 2.45 GHz, and 2.5 GHz.
    • The hopping pattern is randomly generated over 100 time steps.
  2. Jamming:

    • A jammer tries to block communication at a specific frequency (2.45 GHz in this case).
    • If the frequency at a given time step matches the jammer’s frequency, the transmitted signal is assumed jammed (set to 0).

Transmission and Reception

  1. Transmission:

    • If the frequency at a given time step is jammed, the transmitted signal is set to zero.
    • If the frequency is not jammed, the encrypted signal is transmitted.
  2. Reception:

    • At the receiver, the signal is reconstructed based on whether the signal was jammed or not.
    • Decryption is performed by XORing the received signal with the same key.

Error Analysis

After decryption, the program compares the original plaintext message with the decrypted message to check for any errors. If the signal was jammed, parts of the message would be lost, leading to decryption errors.

Rahul

Number of errors in decrypted message: 10

Original Message:     [1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 1 0 0 1
 0 1 1 1 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0
 1 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 1 1 0]
Decrypted Message:    [1 0 0 0 0 1 1 1 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 0 0 0 1
 0 1 1 1 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0
 0 1 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 1 0]
Errors:               10


Figure 1: Encryption and Jamming-Resistant modulation plots

Key Points from the Graphs:

  1. Top Plot - Frequency Hopping and Jamming:

    • Shows how the frequency hops over time, with the red dashed line indicating the jamming frequency.
    • Whenever the hopping pattern intersects with the jamming frequency (2.45 GHz), the signal is jammed.
  2. Middle Plot - Transmitted Signal with Encryption:

    • The signal that was transmitted is shown. If jamming occurs, the signal is lost (set to 0).
  3. Bottom Plot - Decrypted Message:

    • After reception and decryption, this plot shows the final decrypted message.
    • Some errors can be observed due to jamming, as the decrypted message does not perfectly match the original.

Mathematical Explanation:

  • XOR Encryption: The core idea here is to use XOR to toggle bits in the message with a key. The XOR operation is mathematically represented as:

C=MKC = M \oplus K

where CC is the ciphertext (encrypted message), MM is the plaintext (original message), and KK is the encryption key. Decryption works similarly:

M=CKM = C \oplus K

This restores the original message because of the properties of XOR:

AA=0,A0=AA \oplus A = 0, \quad A \oplus 0 = A

  • Error Detection: By comparing the original and decrypted message, the program counts the number of bits that differ, highlighting the impact of jamming on the communication system.

The Number of Errors:

In the output, the original message and decrypted message are displayed. The system detected 10 errors caused by jamming, which disrupted certain time steps of the signal.

Key Considerations and Limitations

While encryption and frequency hopping provide a robust security framework, it's essential to note that they are not foolproof. Strong cryptographic algorithms and key management practices are crucial to prevent attacks like brute-force and cryptanalysis. Additionally, physical security measures must be in place to protect the encryption keys and hardware.

Let me know if you have any suggestions or questions in the comments. This part is implemented in Rahul-Github part-1.py code.


4. Advanced Encryption Standard (AES) technique

The AES (Advanced Encryption Standard) encryption applied in my code is a symmetric key encryption algorithm that is widely used for securing data.

Key Characteristics of AES 

1. Symmetric Key Encryption:

  • AES is a symmetric encryption algorithm, meaning that the same key is used for both encryption and decryption. In the code, the key is generated using token_bytes(16), which creates a random 16-byte key. This is suitable for AES-128 encryption, which uses a key size of 128 bits.

2. Block Cipher:

  • AES operates on fixed-size blocks of data. It processes data in blocks of 128 bits (16 bytes) at a time. If the input data is larger than this block size, it will be divided into multiple blocks for encryption.

3. Modes of Operation:

  • My implementation uses EAX mode (AES.MODE_EAX), which is an authenticated encryption mode. EAX mode provides both confidentiality (encryption) and integrity (authentication) for the data being encrypted. This is particularly important for ensuring that the data has not been tampered with.
  • In EAX mode, a nonce (number used once) is generated for each encryption operation. This nonce must be unique for each key and is used to ensure that identical plaintexts encrypt to different ciphertexts, providing security against replay attacks.

4. Nonce and Tag:

  • The nonce is generated as part of the encryption process and is essential for the correct functioning of EAX mode. It should be unique for every encryption with the same key to maintain security.
  • The tag is an authentication tag that is generated during encryption. It is used during decryption to verify the integrity of the data. If the ciphertext has been altered or if the incorrect key is used during decryption, the verification will fail, and the decryption will return False.

5. Encryption and Decryption Process:

  • The encrypt function takes a plaintext message, generates a nonce, and produces the ciphertext along with the authentication tag.
  • The decrypt function uses the nonce, ciphertext, and tag to attempt to decrypt the message. If the tag verification fails, it indicates that the ciphertext may have been tampered with or that the wrong key was used.

6. Security:

  • AES is considered secure and efficient for encrypting data. It is widely adopted in various applications, from securing communications (like HTTPS) to encrypting files and disks.

Simulation Flow:

- Assume the simulation runs and the current time is 10 milliseconds. The modulo operation 10 % 100 results in 10, which is present in the jam_steps list.

- The transmission will be jammed at this point, and the transmitted signal will be zero, indicating that the data could not be successfully sent.

- If the time is 5 milliseconds, since 5 is not in jam_steps, the signal would proceed to check the error_rate. If it falls under the 10% chance, it might introduce an error in the ciphertext.

This part is implemented in Rahul-Github part-2.py code. 



Plaintext: Encrypting messages using AES
Encrypted ciphertext (hex): 1bed866ea7515e7da537c3adc89679f01c4b4aca6afb3e4be117827e16
Decrypted Plaintext (after last trial): Encrypting messages using AES
Total errors encountered during the last transmission: 11

Fig. 2: Network analytics after applying AES encryption to the transmitted data.


5. Modulation






Comments

Popular posts from this blog

5G Core Architecture