Chirag Project Report - Merged

Download as pdf or txt
Download as pdf or txt
You are on page 1of 57

Project Report

On
Photo Cryptography App
Submitted in partial fulfilment of the requirements for the award of the
degree of
Bachelor of Technology In

Computer Science Engineering

Submitted by: Submitted to:


Chirag (25640) Mr. Dheeraj Sahni
8th Semester (CSE-B) UIET (MDU)

UNIVERSITY INSTITUTE OF ENGINEERING & TECHNOLOGY


MAHARSHI DAYANAND UNIVERSITY, ROHTAK – 124001
Jan-May, 2024
Abstract

The purpose of this report is to fulfil the project requirement


for Bachelors of Technology in Computer Science and
Engineering.

SecureSnap is a cutting-edge mobile application designed to


provide users with robust encryption and cryptographic
techniques to safeguard their sensitive photos. With the
proliferation of digital imagery and the increasing concern for
privacy, SecureSnap offers a comprehensive solution for
individuals seeking to protect their visual data from
unauthorized access and exploitation. SecureSnap represents a
breakthrough in photo cryptography, offering users a
comprehensive solution for protecting their sensitive visual
data. By combining advanced encryption techniques, secure
photo sharing capabilities, and user-friendly design,
SecureSnap empowers individuals to take control of their
privacy in an increasingly digital world.
Acknowledgement

I would like to express my gratitude to MDU ROHTAK for


providing me with the opportunity to work on this project. The
project was undertaken as a part of my academic curriculum,
and I would like to thank the UIET for providing me with the
necessary resources and guidance to complete the project
successfully. I am also thankful to my project supervisor. For
their support, guidance, and feedback throughout the project.
Their insights and suggestions were invaluable in helping me
to refine the project and achieve its objectives. I would also like
to express my gratitude to my fellow students who supported
me during the project. Their encouragement and constructive
feedback were instrumental in helping me to overcome
challenges and achieve success. Finally, I would like to thank
my family and friends for their unwavering support and
encouragement throughout the project. Their belief in my
abilities and their encouragement gave me the motivation to
work hard and complete the project to the best of my abilities.
Once again, thank you to all those who contributed to the
successful completion of this project.
Candidate Declaration Certificate

We hereby certify that the work which is being presented in the


project report entitled “SecureSnap” by Chirag (25640) in
partial fulfilment of requirements for the award of degree of
B.Tech submitted to Department of CSE, U.I.E.T at M.D.U
Rohtak is an authentic record of our own work carried out
during a period from January to May, 2024 under the
supervision of Mr. Dheeraj Sahni

Signature of the Student

This is to certify that the above statement by the candidate is


correct to the best of my knowledge.

Signature of the SUPERVISOR


INDEX
S.No Topic Page No.

1. Abstract

2. Acknowledgment

3. Declaration

4. Index

5. Introduction

6. Objective

7. Project Description

8. Problem Statement

9. Designing
10. Coding

11. Model used In project

12. Scope of maintenance &


upgradation in project

13. Testing

14. Tools used in project

15. Conclusion

16. Reference
Introduction

➢ Image cryptography is a field of cryptography that deals


with securing digital images by encrypting them. Cryptography
is the practice of secure communication in the presence of third
parties or adversaries. Image cryptography is essential for
secure transmission of images over insecure networks, such as
the internet.

➢ Image cryptography algorithms can be used to encrypt


images to protect their content from unauthorized access. The
goal of image cryptography is to make sure that only authorized
users can access the images and that the images cannot be
modified or tampered with during transmission.

➢ There are two main techniques used in image cryptography:


symmetric key encryption and public key encryption.
Symmetric key encryption is a technique where the same key
is used for both encryption and decryption of the image. Public
key encryption is a technique where two keys are used, one for
encryption and the other for decryption.

➢ In addition to encryption, other techniques used in image


cryptography include watermarking and steganography.
Watermarking is the process of embedding a hidden message
into an image to verify its authenticity, while steganography is
the process of hiding a secret message inside an image without
changing the appearance of the image

➢ In an era where digital imagery has become ubiquitous and


privacy concerns are paramount, the need for robust solutions
to protect sensitive photos has never been greater. Enter the
world of photo cryptography apps, where cutting-edge
technology meets the imperative need for privacy and
security.
With the advent of smartphones equipped with high-resolution
cameras, capturing and sharing photos has become effortless.
However, this convenience comes with inherent risks, as
sensitive visual data can easily fall into the wrong hands if not
adequately protected. Photo cryptography apps address this
challenge by leveraging cryptographic techniques to encrypt
and safeguard photos, ensuring that only authorized individuals
can access and view them.
These apps serve as a shield against unauthorized access,
interception, and exploitation of personal or confidential visual
content. By employing advanced encryption algorithms and
secure transmission protocols, photo cryptography apps
provide users with peace of mind, knowing that their photos are
shielded from prying eyes.
Moreover, photo cryptography apps offer a range of features
designed to enhance security and usability. From end-to-end
encryption to biometric authentication, these apps provide
users with flexible tools to customize their privacy preferences
according to their needs.
In this introduction to photo cryptography apps, we will explore
the fundamental principles behind their operation, examine key
features that distinguish them from conventional photo
management tools, and discuss the implications of their
adoption in an increasingly digitized society. Whether you're a
casual photographer concerned about preserving personal
memories or a professional handling sensitive visual data,
understanding the role and capabilities of photo cryptography
apps is essential for safeguarding your digital assets in today's
interconnected world.
Objectives

The primary objectives of an image cryptography app can be broken


down into two main categories:

A. Data Security and Privacy:


• Confidentiality: The app's core objective is to ensure the
confidentiality of the image data. This means that only authorized
users with the correct key or password should be able to access
the original information within the image. Encryption scrambles
the image data, making it unintelligible to anyone without the key.
Steganography hides the data within another image, making its
very presence undetectable.
• Data Integrity: The app should maintain the integrity of the
image data during encryption and decryption processes. This
means that the decrypted image should be an exact replica of the
original image, without any unintended modifications.
B. User Experience and Manageability:
• Ease of Use: The app should be user-friendly and intuitive,
allowing users with varying technical expertise to encrypt and
decrypt images efficiently. A clear and well-designed interface is
crucial for this objective.
• Security Strength: The app should strike a balance between
strong encryption and efficient processing speed. While robust
algorithms offer the best security, they can be computationally
expensive. User selectable options for encryption strength can be
a good approach.
• Manageability: The app should allow users to manage their
encrypted images effectively. This could include features like
batch processing, secure password storage, and options for
sharing encrypted images securely.

1. Data Security: The primary objective of the image cryptography


app is to ensure the security of sensitive visual data. By
implementing robust encryption algorithms, the app aims to
protect images from unauthorized access, interception, and
exploitation.
2. End-to-End Encryption: The app should facilitate end-to-end
encryption of images, ensuring that they are encrypted on the
sender's device and can only be decrypted by the intended
recipient. This prevents intermediaries, including service
providers and hackers, from accessing the content during
transmission.
3. Secure Image Sharing: One of the key objectives is to enable
secure sharing of encrypted images between users. The app
should provide a seamless and secure mechanism for users to
share encrypted images with trusted contacts while preventing
unauthorized individuals from accessing the content.
4. User Authentication: Implementing robust user authentication
mechanisms is essential to ensure that only authorized users can
access the encrypted images. The app should offer options for
password protection and biometric authentication to verify the
identity of users before granting access to encrypted image data.
5. Intuitive User Experience: A user-friendly interface is crucial to
the success of the app. The objectives include designing an
intuitive user experience that makes encryption and decryption
processes straightforward and accessible to users of all technical
backgrounds.
6. Cross-Platform Compatibility: To maximize accessibility, the
app should be compatible with multiple platforms, including iOS,
Android, and web browsers. This ensures that users can securely
access and share encrypted images across different devices and
operating systems.
7. Privacy Protection: Protecting user privacy is paramount. The
app should adhere to strict privacy standards and ensure that
encrypted image data always remains confidential and
inaccessible to unauthorized parties.
8. Scalability and Performance: As the user base grows, the app
should be scalable to accommodate increased demand while
maintaining optimal performance. This includes efficient
encryption and decryption processes, minimal latency during
image transmission, and seamless integration with cloud storage
solutions for scalability.
9. Continuous Improvement: The objectives also include a
commitment to continuous improvement based on user feedback
and emerging security threats. Regular updates and enhancements
should be made to the app to address evolving user needs and
ensure ongoing security against emerging vulnerabilities.
By achieving these objectives, the image cryptography app aims to
provide users with a secure and user-friendly solution for protecting
their sensitive visual data and safeguarding their digital privacy in an
increasingly interconnected world.
Project Description

In an age where digital privacy is a growing concern, the


protection of sensitive visual data has become paramount. Our
project aims to develop an Image Cryptography App, a
powerful tool designed to encrypt and secure images to
prevent unauthorized access and ensure privacy. This project
description outlines the key features, technologies, and goals
of our Image Cryptography App.
Key Features:
1. End-to-End Encryption: The core feature of our app is
end-to-end encryption, ensuring that images are encrypted
on the sender's device and can only be decrypted by the
intended recipient. This prevents interception and
unauthorized access to the images during transmission.
2. Advanced Encryption Algorithms: We will implement
state-of-the-art encryption algorithms such as AES
(Advanced Encryption Standard) and RSA (Rivest-
Shamir-Adleman) to provide robust security for encrypted
images. These algorithms will ensure that even if the
encrypted data is intercepted, it remains secure and cannot
be deciphered without the decryption key.
3. Secure Image Sharing: Our app will allow users to
securely share encrypted images with others. Recipients
will need the decryption key to unlock and view the
images, ensuring that only authorized individuals can
access the sensitive visual data.
4. Password Protection and Biometric Authentication: To
enhance security, our app will offer options for password
protection and biometric authentication. Users can set up
strong passwords or use biometric features such as
fingerprint or facial recognition to access the app and
decrypt images.
5. Stealth Mode: We will include a stealth mode feature that
allows users to conceal the app's presence on their device.
This provides an additional layer of privacy and security,
ensuring that the app remains hidden from prying eyes.
6. Intuitive User Interface: Despite its advanced security
features, our app will have an intuitive and user-friendly
interface. We aim to make the encryption and decryption
process as seamless as possible, even for users with
limited technical expertise.
Technologies:
Our Image Cryptography App will be developed for Android
platform using native development frameworks such as JAVA
for Android. We will leverage cryptographic libraries and APIs
to implement encryption and decryption algorithms securely.
Additionally, we will incorporate modern design principles and
UI/UX patterns to create a visually appealing and user-friendly
experience.
Goals:
The primary goal of our project is to provide users with a secure
and user-friendly solution for encrypting and protecting their
images. We aim to deliver an app that meets the highest
standards of security while remaining accessible to a wide
range of users. Additionally, we will prioritize user feedback
and iterate on the app based on user testing and reviews to
continually improve its functionality and usability.
Conclusion:
Our Image Cryptography App project aims to address the
growing need for privacy and security in the digital age by
providing users with a powerful tool for encrypting and
protecting their images. With advanced encryption algorithms,
secure sharing capabilities, and intuitive design, our app will
empower users to take control of their digital privacy and
ensure that their sensitive visual data remains secure.
Problem Statement

In today's digital landscape, the proliferation of image-sharing


platforms and the ease of capturing and transmitting visual data
have led to heightened concerns about privacy and security.
With the potential for sensitive images to be intercepted,
accessed, or exploited by unauthorized parties, there is a
pressing need for a robust solution to protect such data. The
Problem Statement for our Image Cryptography App project
addresses this critical issue by identifying key challenges and
outlining the objectives of the project.

Challenges:
1. Vulnerability of Image Data: Digital images are
susceptible to interception and unauthorized access during
transmission over networks. Without adequate encryption
measures, sensitive visual data can be compromised,
leading to privacy breaches and potential misuse.
2. Lack of Secure Sharing Options: Existing image-
sharing platforms often lack robust encryption features,
leaving users vulnerable to privacy violations when
sharing sensitive images with others. Without secure
sharing options, individuals may hesitate to share personal
or confidential visual content.
3. Complexity of Encryption: Implementing effective
encryption algorithms for images requires specialized
knowledge and expertise in cryptography. Many users
may lack the technical skills necessary to encrypt their
images securely, leading to potential security gaps and
vulnerabilities.

Objectives:
1. Develop a Secure Encryption Solution: Our primary
objective is to develop an Image Cryptography App that
offers a secure encryption solution for protecting sensitive
images. By implementing advanced encryption algorithms
and secure transmission protocols, we aim to prevent
unauthorized access to encrypted image data.
2. Facilitate Secure Image Sharing: We seek to provide
users with a secure platform for sharing encrypted images
with others. Our app will enable users to securely transmit
encrypted images to recipients, ensuring that only
authorized individuals can access the visual content.
3. Ensure User-Friendly Experience: While prioritizing
security, we aim to design an app that is intuitive and user-
friendly. Our objective is to make encryption and
decryption processes seamless and accessible to users of
all technical backgrounds, minimizing barriers to
adoption.
4. Enhance Privacy and Confidentiality: By empowering
users to encrypt their images, our app aims to enhance
privacy and confidentiality in image sharing. We aim to
provide individuals with greater control over their digital
privacy and mitigate the risk of privacy breaches and
unauthorized access to sensitive visual data.
Conclusion:
The Problem Statement for our Image Cryptography App
project underscores the need for a secure and user-friendly
solution to address the challenges of image privacy and security
in today's digital environment. By identifying key challenges
and outlining clear objectives, we aim to develop an app that
empowers users to protect their sensitive images and safeguard
their digital privacy with confidence
Designing

Input Design

The input design in an image cryptography app should be


intuitive and user-friendly, focusing on both clarity and
security. Here are some key aspects to consider:
Image Selection:
• Drag and Drop: Allow users to easily drag and drop
images from their file explorer directly onto the app
interface for encryption/decryption.
• Browse Files: Provide a clear button or menu option to
browse and select images from the user's device storage.
• Multiple Image Selection: Enable selecting and
processing multiple images at once for batch
encryption/decryption (if supported as a feature).
• Supported Formats: Clearly display a list of supported
image formats (e.g., JPEG, PNG, BMP) to avoid
compatibility issues.
Password/Key Input:
• Secure Password Field: Use a masked password field to
hide characters as users type, preventing shoulder surfing.
• Strength Indicator: Consider including a password
strength meter to guide users towards creating strong
passwords for encryption.
• Key Management: If using a separate key for encryption,
provide a secure way for users to enter, store, and manage
the key (consider secure key storage options).
• Remember Me Option: For decryption, offer an optional
"Remember Me" checkbox to store the password or key
securely on the device (with clear warnings about the
security implications).

Output Design

The output design of an image cryptography app should


prioritize clarity, security, and user-friendliness. Here's a
breakdown of key elements:
Visual Elements:
• Progress Indicators: Show the progress of
encryption/decryption processes, especially for larger
images.
• Success/Error Messages: Clearly inform users about the
outcome of the operation (encryption/decryption
successful, errors encountered).
• Image Preview: After successful decryption, allow users
to preview the decrypted image before saving it.
Information Display:
• Encrypted/Decrypted File Details: Display the
filename, format, and size of the original and processed
image files.
• Security Information (Optional): For advanced users,
consider displaying details like the encryption algorithm
used or key strength (if applicable).
User Actions:
• Output Options: Provide clear options for users to:
o Save the encrypted/decrypted image.
o Share the encrypted image securely (e.g., copy to
clipboard, email with password protection).
o Open the decrypted image with their default image
viewer.
• Clear Instructions: Guide users on what to do next,
especially after successful operations (e.g., "Image
decrypted successfully. Click 'Save' to keep it").
Security Considerations:
• Minimize File Information Display: Avoid displaying
sensitive information embedded within the image (e.g.,
comments, geotags) in the output.
• Password/Key Management: If passwords or keys are
used, ensure there's no echo or display of the entered
password during encryption. Consider options for secure
key storage and retrieval.
Additional Considerations:
• Progress bars and visual indicators should be visually
appealing and easy to understand.
• Error messages should be specific and actionable,
guiding users on how to resolve the issue.
• The overall design should be consistent with the app's
theme and user interface for a cohesive experience.
By following these guidelines, you can create an image
cryptography app with a user-friendly and secure output
design that effectively communicates results and guides users
through the process.
Coding

Starting Interface (xml)

<?xml version="1.0" encoding="utf-8"?>


<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/digital"
tools:context=".MainActivity">

<TextView
android:id="@+id/txtview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Photo Secure"
android:textColor="#fff"
android:textSize="26sp"
android:textStyle="bold"
android:elevation="3dp"
android:layout_marginTop="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<RelativeLayout
android:id="@+id/r1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/search_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtview"
app:layout_constraintStart_toStartOf="parent">

<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
app:tint="#000000"
android:src="@drawable/edit"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="55dp"
android:text="Photo Encryption Decryptiom"
android:textColor="#03082b"
android:textSize="12sp"/>

</RelativeLayout>

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:paddingTop="30dp"
android:orientation="horizontal"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/r1">

<ImageView
android:id="@+id/img_encrypt"
android:layout_width="230dp"
android:layout_height="210dp"
android:elevation="5dp"
android:src="@drawable/pic3"/>

</LinearLayout>

<ImageView
android:id="@+id/logo_img"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginTop="60dp"
android:elevation="5dp"
android:src="@drawable/log"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout"/>

</androidx.constraintlayout.widget.ConstraintLayout>
Main Interface (xml)

<?xml version="1.0" encoding="utf-8"?>


<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/digital"
tools:context=".PhotoCrypto">

<ImageView
android:id="@+id/imgView"
android:layout_width="200dp"
android:layout_height="300dp"
android:layout_marginBottom="30dp"
android:elevation="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:src="@drawable/gal"/>

<Button
android:id="@+id/enc_btn"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="30dp"
android:layout_marginTop="30dp"
android:backgroundTint="#8b0000"
android:text="Encrypt"
android:textColor="#ffffff"
android:textSize="19sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<Button
android:id="@+id/dec_btn"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="30dp"
android:layout_marginTop="30dp"
android:backgroundTint="#000088"
android:text="Decrypt"
android:textColor="#ffffff"
android:textSize="19sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/enc_btn"/>

<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="30dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="0dp"
app:layout_constraintBottom_toBottomOf="@+id/copy_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dec_btn">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<EditText
android:id="@+id/enc_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:hint="Enter your text here..."
android:padding="39dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="30sp" />

</LinearLayout>
</ScrollView>

<Button
android:id="@+id/copy_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginHorizontal="30dp"
android:layout_marginBottom="8dp"
android:backgroundTint="#000000"
android:text="Copy code"
android:textColor="#ffffff"
android:textSize="13sp"
android:onClick="copyCode"
app:layout_constraintBottom_toTopOf="@+id/imgView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

Main Activity (JAVA)

package com.example.photocryptography;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

ImageView imageEncrypt;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().hide();
imageEncrypt = findViewById(R.id.img_encrypt);
imageEncrypt.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view) {
Intent m2 = new
Intent(MainActivity.this,PhotoCrypto.class);
startActivity(m2);
}
});

}
}

Manifest (xml)

<?xml version="1.0" encoding="utf-8"?>


<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission
android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.INTERNET"
/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAG
E"/>
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE
"/>

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.PhotoCryptography"
tools:targetApi="31">
<activity
android:name=".PhotoCrypto"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

Main Code (Java)

package com.example.photocryptography;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.PackageManagerCompat;

import android.Manifest;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.ImageDecoder;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Base64;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Locale;

public class PhotoCrypto extends AppCompatActivity {

Button encrypt,decrypt;
String image;
ClipboardManager clipboardManager;
ImageView imgView;
EditText encImg;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photo_crypto);
ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setTitle("Crypt Image");
actionBar.show();

encrypt = findViewById(R.id.enc_btn);
decrypt = findViewById(R.id.dec_btn);
encImg = findViewById(R.id.enc_txt);
encImg.setEnabled(true);
imgView = findViewById(R.id.imgView);
clipboardManager = (ClipboardManager)
getSystemService(Context.CLIPBOARD_SERVICE);

encrypt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(ContextCompat.checkSelfPermission(PhotoCrypto.this,
Manifest.permission.READ_MEDIA_IMAGES)!=
PackageManager.PERMISSION_GRANTED){

ActivityCompat.requestPermissions(PhotoCrypto.this,new String[] {
Manifest.permission.READ_MEDIA_IMAGES
}, 100);
}
else{
selectPhoto();
}
}
});

encrypt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(ContextCompat.checkSelfPermission(PhotoCrypto.this,

Manifest.permission.READ_EXTERNAL_STORAGE)!=
PackageManager.PERMISSION_GRANTED){

ActivityCompat.requestPermissions(PhotoCrypto.this,new String[] {

Manifest.permission.READ_EXTERNAL_STORAGE
}, 100);
}
else{
selectPhoto();
}
}
});

decrypt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
byte[] bytes =
Base64.decode(encImg.getText().toString(),Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0,
bytes.length);
imgView.setImageBitmap(bitmap);
}
});

private void selectPhoto() {


Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "Select
Picture"), 100);
}
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions,
grantResults);
if (requestCode == 100 &&
grantResults[0]==PackageManager.PERMISSION_GRANTED){
selectPhoto();
}
else {
Toast.makeText(this, "Permission
Denied!",Toast.LENGTH_SHORT).show();
}
}

public void copyCode(View view){


String codes= encImg.getText().toString().trim();
if (!codes.isEmpty()){
ClipData temp = ClipData.newPlainText("text",codes);
clipboardManager.setPrimaryClip(temp);
Toast.makeText(this, "Copied to clipboard!",
Toast.LENGTH_SHORT).show();
}
}

@Override
protected void onActivityResult(int requestCode, int resultCode,
@Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == 100 && resultCode == RESULT_OK &&


data!=null){
Uri uri = data.getData();
Bitmap bitmap;
ImageDecoder.Source source = null;

if(Build.VERSION.SDK_INT >=
Build.VERSION_CODES.P){
source =
ImageDecoder.createSource(this.getContentResolver(),uri);

try {
bitmap = ImageDecoder.decodeBitmap(source);
ByteArrayOutputStream stream = new
ByteArrayOutputStream();

bitmap.compress(Bitmap.CompressFormat.JPEG,100,stream);
byte[] bytes = stream.toByteArray();
image =
Base64.encodeToString(bytes,Base64.DEFAULT);
encImg.setText(image);
Toast.makeText(this,"Image Encrypted! Click on Decrypt
to restore!",Toast.LENGTH_SHORT).show();
}
catch (IOException e){
e.printStackTrace();
}

}
}
}
Model Used in Project

There are various models that can be used in image


cryptography depending on the specific task and approach
used. However, I have used this model for image cryptography:

Symmetric Key Cryptography: In this approach, a shared


secret key is used to encrypt and decrypt an image. The most
used symmetric key cryptography algorithms are AES
(Advanced Encryption Standard) and DES (Data Encryption
Standard).

But, on the other and there are some more which can be used

➢ Advanced Encryption Standard (AES): It is a symmetric


encryption algorithm widely used for securing digital
information. AES can be used for image encryption by treating
the image as a binary file and then applying AES encryption to
the binary data.

➢ Blowfish: It is a symmetric key block cipher that can be used


for encryption and decryption of digital data. Blowfish can be
used for image encryption by treating the image as a binary file
and then applying Blowfish encryption to the binary data.
➢ RSA: It is an asymmetric encryption algorithm that can be
used for encrypting and decrypting data. RSA can be used for
image encryption by encrypting the image using a public key
and decrypting it using a private key.

➢ Chaos-based encryption: It is a type of encryption that uses


chaotic systems and their properties to encrypt data. Chaos-
based encryption can be used for image encryption by
converting the image into a sequence of numbers and then
using a chaotic system to encrypt the sequence.

➢ Substitution-permutation network (SPN): It is a type of


symmetric-key block cipher that uses a combination of
substitution and permutation operations to encrypt data. SPN
can be used for image encryption by treating the image as a
sequence of pixels and then applying SPN encryption to the
pixel values

There are two main approaches to image cryptography apps:


1. Encryption: This scrambles the image data using a key,
making it unreadable without the key. Common
encryption algorithms for images include AES (Advanced
Encryption Standard), which is a widely used and secure
symmetric algorithm.
2. Steganography: This hides the image data within another
image, like hiding a message within a picture. This doesn't
necessarily scramble the data itself, but makes it much
harder to detect the presence of a hidden image.
Here's a breakdown of models used in image cryptography
apps:
Encryption Apps:
• AES (Advanced Encryption Standard): This is a
popular and secure option for encrypting image files. It
uses a symmetric key, meaning the same key is used for
encryption and decryption.
Steganography Apps:
• Least Significant Bit (LSB) substitution: This hides data
in the least significant bits of another image, which are less
noticeable to the human eye.
• Transform-domain techniques: These techniques
modify the frequency domain of an image (e.g., wavelet
transform) to embed data without affecting the visual
quality.
Choosing the Right Model:
The best model for your image cryptography app depends on
your needs. If you prioritize security, then encryption with AES
is a good choice. If you need to hide the existence of the data
entirely, then steganography might be a better option.
Scope Of Maintenance and Upgradation in Project

Maintenance and upgradation are essential aspects of any


software project, including image encryption and decryption.
In the case of image encryption and decryption, the scope of
maintenance and upgradation can include the following:

➢ Bug fixes: One of the primary reasons for maintenance and


upgradation is to fix any bugs or errors in the software. This
can involve identifying and resolving issues related to the
encryption and decryption of images.

➢ Security updates: Another critical aspect of maintenance and


upgradation is ensuring that the software is up to date with the
latest security patches and protocols. This can involve updating
the encryption algorithms used in the software to ensure that
images are adequately protected from unauthorized access.

➢ Performance enhancements: Over time, the software may


become slower or less efficient. Maintenance and upgradation
can involve optimizing the code to improve the speed and
performance of image encryption and decryption.

➢ User interface improvements: User feedback can be used to


identify areas of the software that can be improved. This can
involve making changes to the user interface to make the
software more user-friendly and easier to use.

➢ Compatibility updates: As new operating systems and


devices are released; the software may need to be updated to
ensure compatibility. Maintenance and upgradation can involve
making changes to the software to ensure that it works
seamlessly with the latest devices and operating systems.

In summary, the scope of maintenance and upgradation in a


project focused on image encryption and decryption can be
extensive, covering everything from bug fixes and security
updates to performance enhancements and user interface
improvements. By prioritizing maintenance and upgradation,
the software can remain reliable, secure, and efficient over time

The scope of our image cryptography app can vary depending


on your target audience and desired functionalities. Here's a
breakdown of different possibilities:
Basic Features:
• Encryption/Decryption: This is the core functionality,
allowing users to encrypt images with a password or key
and decrypt them for viewing.
• Supported Formats: The app should support common
image formats like JPEG, PNG, and BMP.
• Security Strength: Choose an encryption algorithm
(AES) or steganography technique (LSB) that offers a
good balance between security and processing speed.
• User Interface: A user-friendly interface for selecting
images, entering passwords/keys, and performing
encryption/decryption.
Advanced Features:
• Batch Processing: Encrypt/decrypt multiple images at
once.
• Password Management: Secure storage and retrieval of
passwords/keys.
• Self-Destructing Images: Set images to automatically
decrypt or delete themselves after a certain time.
• Steganography with Password Recovery: Allow hiding
data within images with additional password protection
for retrieval.
• Cloud Storage Integration: Encrypt images before
uploading them to cloud storage services.
• Advanced Encryption Algorithms: Implement stronger
algorithms (like RSA) for maximum security (consider
processing speed trade-offs).
Additional Considerations:
• Target Platform: Mobile app, desktop application, or
web-based tool?
• Security Audits: Regularly review the app's security to
identify and fix vulnerabilities.
• Compliance with Regulations: If the app handles
sensitive data, ensure adherence to relevant data privacy
regulations.
Maintenance of an Image Cryptography App
Maintaining your image cryptography app is crucial for
continued security and functionality. Here are some key
aspects:
• Security Updates: Regularly update the encryption
algorithms and libraries used in the app to address newly
discovered vulnerabilities.
• Bug Fixes: Address bugs reported by users to ensure
smooth operation.
• New Feature Implementation: Consider adding new
features based on user feedback and evolving security
needs.
• Platform Compatibility Updates: Maintain
compatibility with the latest operating systems and device
requirements for your chosen platform.
• Performance Optimization: Monitor and optimize the
app's performance to ensure fast encryption and
decryption times.
Testing of Project

Testing of image encryption and decryption typically involves


verifying that the encrypted image can be correctly decrypted
back into the original image, and that the decrypted image is
identical to the original image. Here are some general steps to
follow for testing image encryption and decryption:

➢ Generate a sample image to be used for testing. This can be


any image in a common format such as JPEG.

➢ Use the image encryption algorithm to encrypt the sample


image. Make sure to record the key or password used for
encryption.

➢ Attempt to decrypt the encrypted image using the same key


or password. Verify that the decrypted image is identical to the
original image.

➢ Try decrypting the encrypted image using an incorrect key


or password. Verify that the decrypted image is not identical
to the original image.
Repeat the above steps with different sample images of
varying sizes and formats to ensure that the encryption and
decryption algorithms work consistently and reliably.

Test the encryption and decryption algorithms with images


that have different levels of complexity and detail to ensure
that they can handle a variety of image types.

Check for any potential security vulnerabilities in the


encryption and decryption algorithms. For example, try to
break the encryption by using known attacks such as brute-
force attacks or known-plaintext attacks.

Finally, document and report any issues or bugs found during


testing and work on fixing them before deploying the
encryption and decryption algorithms in a production
environment.

It is important to note that image encryption and decryption is


a complex process that requires careful testing and evaluation
to ensure that it works as intended and is secure. Therefore, it
is important to engage in thorough testing and verification to
ensure that the algorithm is robust and can be relied upon to
protect sensitive image data.
Tools Used in Project

Android Studio: Android Studio is a powerful software tool


that is widely used in the field for app development. It
provides a range of tools that are very useful to apply
algorithms that can be used to secure images.

Java: Java is another popular programming language that can


be used for image encryption and decryption. There are
several libraries available in Java, such as BouncyCastle
Dependency, which can be used for image processing and
encryption.

GIMP: GIMP (GNU Image Manipulation Program) is a free,


open-source image editing tool that can be used for image
encryption and decryption. It provides a range of encryption
and decryption algorithms that can be used to secure images.

Cryptomator: Cryptomator is a free, open-source encryption


tool that can be used to encrypt images and other files. It
provides end-to-end encryption, which means that only the
intended recipient can decrypt the files.

VeraCrypt: VeraCrypt is a free, open-source encryption tool


that can be used to encrypt entire disks or individual files. It
provides several encryption algorithms, including AES,
Serpent, and Twofish, that can be used to secure images and
other files
Conclusion

In conclusion, image encryption and decryption is a critical


aspect of digital security that involves the transformation of
an image into a coded message that can only be accessed by
an authorized user. It is an essential process for protecting
sensitive and confidential images from unauthorized access
and tampering.

Various encryption techniques such as symmetric encryption,


asymmetric encryption, and hashing can be used to secure
digital images. Each technique has its strengths and
weaknesses, and the appropriate encryption technique should
be chosen based on the specific requirements of the
application.

It is important to note that encryption is not foolproof, and


there is always a risk of breaches and attacks.
However, the use of strong encryption techniques and best
practices can significantly reduce the likelihood of such
incidents.

Overall, image encryption and decryption is an essential


aspect of digital security that should not be overlooked. With
the increasing amount of sensitive data being stored in digital
formats, it is crucial to take measures to protect this data from
unauthorized access, and image encryption and decryption is
an important tool in achieving this goal.

Image cryptography apps offer a valuable tool for protecting


sensitive image data. They can provide strong encryption or
hide information within other images, depending on the
chosen technique.

Key benefits of image cryptography apps include:


• Enhanced Security: Encryption scrambles image data,
making it unreadable without a key, while steganography
conceals the data's very existence.
• Privacy Protection: These apps allow secure sharing of
sensitive images without compromising confidentiality.
• Data Compliance: They can be helpful for adhering to
data privacy regulations by encrypting sensitive data at
rest or in transit.

However, it's important to consider the trade-offs:


• Complexity: Encryption algorithms can be
computationally expensive, impacting processing speed.
Steganography techniques might introduce slight visual
artifacts.
• User Awareness: Proper app usage and key management
are crucial for maintaining security.
• Potential Misuse: While intended for legitimate
purposes, these apps could be misused for malicious
activities.
In conclusion, image cryptography apps are a powerful tool
for securing sensitive image data. By carefully considering the
scope, features, and maintenance requirements, you can
develop a secure and user-friendly application that meets the
needs of your target audience.
References for this Project

❖Oracle Java documentation:


https://docs.oracle.com/en/java/

❖W3Schools Java Servlets tutorial:


https://www.w3schools.com/java/java_servlets.asp

❖Oracle MySQL documentation:


https://dev.mysql.com/doc/

❖JUnit documentation:
https://junit.org/junit5/docs/current/userguide/

❖Git documentation: https://git-scm.com/doc

❖Apache Maven documentation:


https://maven.apache.org/guides/index.html

❖Open AI: https://chat.openai.com

In addition to these references, there are many other online


resources, such as tutorials, forums, and documentation,
that can be useful.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy