Chirag Project Report - Merged
Chirag Project Report - Merged
Chirag Project Report - Merged
On
Photo Cryptography App
Submitted in partial fulfilment of the requirements for the award of the
degree of
Bachelor of Technology In
1. Abstract
2. Acknowledgment
3. Declaration
4. Index
5. Introduction
6. Objective
7. Project Description
8. Problem Statement
9. Designing
10. Coding
13. Testing
15. Conclusion
16. Reference
Introduction
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
Output Design
<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)
<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>
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;
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)
<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>
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;
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);
}
});
@Override
protected void onActivityResult(int requestCode, int resultCode,
@Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
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
But, on the other and there are some more which can be used
❖JUnit documentation:
https://junit.org/junit5/docs/current/userguide/