Secure Data Encryption for Uploading Weather and Soil Data Over HTTP
Creators: name: Amitabh, Amitabh
Publisher: name: Zenodo
Year: 2024

description: 1. Introduction Weather and soil monitoring systems collect vast amounts of environmental data essential for agricultural, climate studies, and disaster prevention. However, transmitting such data over unsecured HTTP channels poses risks of interception, modification, and unauthorized access. Implementing encryption mechanisms ensures data confidentiality, integrity, and authenticity. This paper discusses various encryption algorithms, their implementation, and their impact on IoT-based data security.

2. Challenges in Secure Data Transmission



Data Integrity: Preventing unauthorized data alteration during transmission.

Confidentiality: Ensuring only authorized entities can access transmitted data.

Computational Overhead: Balancing encryption strength with IoT device limitations.

Scalability: Securing increasing volumes of real-time environmental data.


3. Encryption Techniques for HTTP Data Transmission Several encryption techniques can be used to secure weather and soil data transmission over HTTP. Below are the key encryption methods and their practical applications.

3.1 Symmetric Encryption

Symmetric encryption uses a single secret key for both encryption and decryption. It is computationally efficient and suitable for IoT devices with limited processing power.

3.1.1 Advanced Encryption Standard (AES)

AES is a widely used symmetric encryption algorithm that offers strong security and high performance. It supports key lengths of 128, 192, and 256 bits.

Example Implementation of AES-256 in Python:

from Crypto.Cipher import AES

import base64

 

def encrypt_data(data, key):

    cipher = AES.new(key, AES.MODE_EAX)

    ciphertext, tag = cipher.encrypt_and_digest(data.encode())

    return base64.b64encode(cipher.nonce + tag + ciphertext).decode()

 

def decrypt_data(encrypted_data, key):

    encrypted_data = base64.b64decode(encrypted_data)

    nonce = encrypted_data[:16]

    tag = encrypted_data[16:32]

    ciphertext = encrypted_data[32:]

    cipher = AES.new(key, AES.MODE_EAX, nonce=nonce)

    return cipher.decrypt_and_verify(ciphertext, tag).decode()

AES provides high-speed encryption, making it suitable for real-time IoT data transmission.

3.2 Asymmetric Encryption

Asymmetric encryption uses a pair of public and private keys for encryption and decryption, ensuring secure key distribution and authentication.

3.2.1 Rivest-Shamir-Adleman (RSA)

RSA is one of the most commonly used asymmetric encryption algorithms. It uses large prime numbers for key generation and is often used for securing key exchanges.

Example Implementation of RSA in Python:

from Crypto.PublicKey import RSA

from Crypto.Cipher import PKCS1_OAEP

import base64

 

key = RSA.generate(2048)

public_key = key.publickey().exportKey()

private_key = key.exportKey()

 

def encrypt_data_rsa(data, public_key):

    recipient_key = RSA.import_key(public_key)

    cipher_rsa = PKCS1_OAEP.new(recipient_key)

    return base64.b64encode(cipher_rsa.encrypt(data.encode())).decode()

 

def decrypt_data_rsa(encrypted_data, private_key):

    private_key = RSA.import_key(private_key)

    cipher_rsa = PKCS1_OAEP.new(private_key)

    return cipher_rsa.decrypt(base64.b64decode(encrypted_data)).decode()

RSA is used in secure key exchanges but is computationally expensive for large data encryption, making it more suitable for encrypting AES keys rather than raw data.

3.3 Hybrid Encryption

Hybrid encryption combines symmetric and asymmetric encryption to leverage the advantages of both. AES is used for encrypting the data, while RSA secures the symmetric key exchange.

3.4 Transport Layer Security (TLS)

TLS is a cryptographic protocol that ensures secure communication over HTTP by encrypting data in transit. TLS 1.2 and 1.3 are widely used for securing web and IoT communications.

Example of Enforcing TLS in Python Using Requests:

import requests

response = requests.get('https://secure-api.example.com', verify=True)

print(response.text)

TLS prevents eavesdropping and man-in-the-middle attacks, making it essential for secure IoT data transmission.

4. Proposed Encryption Model We propose a hybrid encryption model where IoT devices encrypt weather and soil data using AES-256 before transmission. The encrypted data is further secured via TLS during transport. A key exchange mechanism using RSA ensures secure distribution of encryption keys.

5. Implementation and Performance Evaluation



Test Environment: Simulated IoT weather and soil monitoring system.

Performance Metrics: Encryption latency, data transmission time, and decryption accuracy.

Results: The hybrid encryption model effectively secures data while maintaining low computational overhead, making it suitable for resource-constrained IoT devices.


6. Conclusion Secure data encryption is crucial for transmitting weather and soil data over HTTP. Our proposed hybrid encryption model balances security with efficiency, ensuring reliable and scalable data transmission. Future research will focus on optimizing encryption for low-power IoT networks and exploring post-quantum cryptography methods.