Encrypta is an innovative web application that makes use of both steganography and RSA encryption to provide a robust solution for secure communication. It adopts steganographic embedding of LSB for image files and industrial-standard RSA encryption for text file, with an interface in Flask to embed and extract, as well as encrypt and decrypt sensitive information. The idea meets emerging demand in the healthcare and legal industries due to serious data privacy and security requirements.
While technology has made life more digital, the need to safeguard confidential information has become highly paramount. Current messaging tools are using most inadequate mechanisms to ensure data security and privacy, thus exposing users to breaches.
Encrypta fills this gap by providing a web interface to users for embedding messages in images and encrypting text files. Users can interact with the platform in order to securely transfer confidential information using cryptographic techniques and steganography.
Programming Language: Python 3.9
Web Framework: Flask
Libraries: cryptography, Pillow
The system architecture of Encrypta shows the flow of data and interaction of different components of the application. The architecture comprises the following key modules:
User Interface: The user interface was developed using Flask, which handles user interactions in terms of uploading files, sending processing requests, and then viewing results. It exposes endpoints for embedding messages in images, extracting messages hidden in images, encryption of text files, and decryption of encrypted files.
Steganography Module: This module is used to embed secret messages in images and extract them out. It uses the least significant bit technique to completely hide the message within an image without any noticeable changes in the image.
RSA Encryption Module: This module provides the functionality for encryption and decryption of text files with RSA encryption. It creates public-private key pairs, encrypts text files using the public key, and decrypts them with the private key.
File Storage: It stores original and processed files, which include uploaded images, embedded images, encrypted text files, and decrypted text files. The module ensures that the processed file is presented to the users for download in a very accessible way.
Below is the diagram representing data flow between these modules; this gives an overview of how user requests are handled from input to output.
Figure 1: Encrypta System Architecture
4.1 Steganography
Technique: Encrypta employs the Least Significant Bit (LSB) embedding technique to hide messages within image files.
Implementation Highlights
Message Encoding: Messages are base64 encoded and embedded bit-by-bit into pixel values. A delimiter ensures accurate extraction.
Validation Checks: Prevent embedding messages that exceed the image's capacity.
Pseudocode for Embedding a Message:
**pseudocode**
function embed_message(image_path, message_path):
img = open_image(image_path)
width, height = get_image_dimensions(img)
message = read_file(message_path)
encoded_message = base64_encode(message) + "==="
message_bits = convert_to_binary(encoded_message)
if length(message_bits) > width * height * 3:
raise error("Message is too large for the image.")
pixels = get_image_pixels(img)
message_index = 0
for each pixel in pixels:
if message_index < length(message_bits):
r, g, b = get_pixel_values(pixel)
r_bin = convert_to_binary(r)
g_bin = convert_to_binary(g)
b_bin = convert_to_binary(b)
if message_index < length(message_bits):
r_bin = replace_least_significant_bit(r_bin, message_bits[message_index])
message_index += 1
if message_index < length(message_bits):
g_bin = replace_least_significant_bit(g_bin, message_bits[message_index])
message_index += 1
if message_index < length(message_bits):
b_bin = replace_least_significant_bit(b_bin, message_bits[message_index])
message_index += 1
new_r = convert_to_integer(r_bin)
new_g = convert_to_integer(g_bin)
new_b = convert_to_integer(b_bin)
update_pixel(pixel, new_r, new_g, new_b)
new_image = create_image_from_pixels(pixels, width, height)
save_image(new_image, new_image_path)
return new_image_path
Pseudocode for Extracting a Message:
**pseudocode**
function extract_message(image_path):
img = open_image(image_path)
pixels = get_image_pixels(img)
message_bits = []
for each pixel in pixels:
r, g, b = get_pixel_values(pixel)
message_bits.append(get_least_significant_bit(r))
message_bits.append(get_least_significant_bit(g))
message_bits.append(get_least_significant_bit(b))
message_bin = join_bits(message_bits)
message_chars = convert_to_characters(message_bin)
message = join_chars(message_chars)
delimiter_index = find_delimiter(message, "===")
if delimiter_index != -1:
message = message[0:delimiter_index]
decoded_message = base64_decode(message)
return decoded_message
4.2 RSA Encryption
Algorithm: The RSA encryption module utilizes Python's cryptography library for generating secure key pairs, encrypting, and decrypting text files.
Implementation Highlights
Key Generation: Public-private key pairs are dynamically generated.
Encryption: Base64 encoding ensures compatibility and readability of encrypted outputs. Files are encrypted with secure padding (OAEP with SHA-256).
Pseudocode for Encrypting Text:
**pseudocode**
function generate_rsa_keypair():
private_key = generate_private_key()
public_key = get_public_key(private_key)
return private_key, public_key
function encrypt_text(public_key, text):
encrypted_values = []
for each character in text:
encrypted_byte = encrypt_with_public_key(public_key, character)
encoded_byte = base64_encode(encrypted_byte)
encrypted_values.append(encoded_byte)
return encrypted_values
Pseudocode for Decrypting Text:
**pseudocode**
function decrypt_rsa(encrypted_bytes, private_key):
decrypted_bytes = decrypt_with_private_key(private_key, encrypted_bytes)
return convert_to_text(decrypted_bytes)
4.3 Flask Integration
Interface: Flask powers the user interface, enabling easy file uploads, processing, and result downloads.
Endpoints:
/encrypt and /decrypt: Encrypt and decrypt text files.
/embed and /extract: Embed and extract messages in/from images.
5.1 Steganography Inputs/Outputs
Before: An unmodified image.
Figure 2: Unembedded image
Before: The input message file to be embedded
Figure 3: Input message
After: The same image with an embedded message, visually indistinguishable from the original.
Figure 4: Stego-Embedded image
After: The extracted output message:
Figure 5: Out message
5.2 RSA Encryption Outputs
Encrypted File: A text file securely encrypted using RSA.
Input file:
Figure 6: Input message file
Encrypted file text:
Figure 7: Encrypted input message file
Decrypted File: Successfully restored to its original content.
Figure 8: Decrypted output message file
5.3 Encrypta UI:
Encrypta homepage UI
Figure 9: Encrypta homepage
Performance Benchmarks:
Image embedding time: ~1 second for images under 5MB.
RSA encryption and decryption: Handles files up to 1MB efficiently.
Encrypta demonstrates a novel use of steganography and RSA encryption for enhanced secure communication. Featuring a web-based user-friendly interface and using a powerful implementation, this can prove to be of much help to industries that emphasize data security and privacy.
Rivest, R. L., Shamir, A., & Adleman, L. (1978). A method for obtaining digital signatures and public-key cryptosystems. Communications of the ACM, 21(2), 120–126. https://doi.org/10.1145/359340.359342
Johnson, N. F., & Jajodia, S. (1998). Exploring steganography: Seeing the unseen. Computer, 31(2), 26–34. https://doi.org/10.1109/mc.1998.4655281
Python cryptography Library: https://cryptography.io
Gitub Repo: https://github.com/Dankummzy/Encrypta
There are no models linked
There are no datasets linked
There are no datasets linked
There are no models linked