Beruflich Dokumente
Kultur Dokumente
2 SYSTEM STUDY
2.1 EXISTING SYSTEM
2.2 PROPOSED SYSTEM
2.3 FEASABILITY STUDY
2.4 OBJECTIVE
3 SYSTEM SPECIFICATION
3.1 HARDWARE SPECIFICATION
3.2 SOFTWARE SPECIFICATION
4 LANGUAGE DESCRIPTION
7 FUTURE ENHANCEMENT
8 CONCLUSION
9 LIST OF REFERENCE
LIST OF TABLES
2. Logical connection:
There is no data loss during transmission so at receiving end the media file
can view with maximum quality.
Having enough CPU power and bus bandwidth to support the required data
rates.
AES ALGORITHM:
It stands for Advanced Encryption Standard.
In Traditional Encryption schemes, the sender and the receiver uses the
same key to encrypt and decrypt the data.
AES is one of the most popular algorithms used in symmetric key
cryptography.
Encryption is the process of changing the data into a form that can be read
only by the intended receiver.
SYSTEM STUDY
2.SYSTEM STUDY
2.1EXISTING SYSTEM:
The media file is first splitted into audio and video files
separately. The audio file is encrypted using AES process and divided into packets
and the video files is splitted into frames and each frame is encrypted using AES
process. Frames are converted in pixels. Finally, the audio and video files are
merged together as media files and transmitted to the client.
2.3 FEASIBILITY STUDY
All projects are feasible given unlimited resources and infinite time. It is
both necessary and prudent to evaluate the feasibility of the project at the earliest
possible time. Feasibility and risk analysis is related in many ways. If project risk
is great , the feasibility listed below is equally important.
• Operational Feasibility
• Technical Feasibility
• Economic Feasibility
Operational Feasibility:
Proposed system is beneficial since it turned into information system
analyzing the traffic that will meet the organizations operating
requirements.
IN security, the file is transferred to the destination and the
acknowledgement is given to the server. Bulk of data transfer is sent
without traffic.
Technical Feasibility:
Technical feasibility centers on the existing computer system (hardware ,
software, etc..) and to what extent it can support the proposed addition. For
example, if the current computer is operating at 80% capacity. This involves,
additional hardware (RAM and PROCESSOR) will increase the speed of the
process. In software, Open Source language that is JAVA and JMF is used. We
can also use in Linux operating system.
The technical requirement for this project are Java tool kit and
Swing component as software and normal hardware configuration is
enough , so the system is more feasible on this criteria.
Economic Feasibility:
Economic feasibility is the most frequently used method for
evaluating the effectiveness of a candidate system. More commonly known as cost
/ benefit analysis, the procedure is to determine the benefits and saving that are
expected from a candidate and compare them with the costs. If the benefits
outweigh cost. Then the decision is made to design and implement the system.
Otherwise drop the system.
This system has been implemented such that it can be used to analysis
the traffic. So it does not requires any extra equipment or hardware to implement.
So it is economically feasible to use.
2.4 OBJECTIVES :
Processor : Pentium-III
Speed : 1.1GHz
RAM : 512MB
Hard Disk : 40GB
General : KeyBoard, Monitor , Mouse
Although the above appears to be a list of buzzwords, they apply describe the
full potential of language. These features have made java the first application
language of the world wide web. Java will also become the primer language for
general-purpose stand-alone applications.
Object-Oriented:
Java is a true object oriented language. Almost everything in Java is an
Object. All program code and data reside within objects and classes. Java
comes with an extensive set of classes, arranged in packages, that we can use
in our programs by inheritance. The object model in Java is simple and easy to
extend.
Robust and Secure:
Distributed:
Familiarity is another striking feature of Java .To make the language look
familiar to the existing programmers, it was modeled on C and C++ and therefore,
Java “looks like C and C++” code.In fact, Java is a simplified version of C++.
SWING:
Swing is a set of classes that provides more powerful and flexible
components than are possible with the AWT. In addition to that the familiar
components such as buttons, check box and labels swings supplies several
exciting additions including tabbed panes, scroll panes, trees and tables. Even
familiar components such as buttons have more capabilities in swing. For example
a button may have both an image and text string associated with it. Also the image
can be changed as the state of button changes. Unlike AWT components swing
components are not implemented by platform specific code instead they are return
entirely in JAVA and, therefore , are platform- independent. The term lightweight
is used to describe such elements. The number of classes and interfaces in the
swing packages is substantial.
The swing component classes are
SWING COMPONENT CLASSES
Class Description
Abstract Button Abstract super class for Swing
Buttons
Button Group Encapsulates a mutually exclusive
Set of Buttons
Image Icon Encapsulates an Icon
Network:
Distributed Processing:
Security/encapsulation.
Distributed databases.
OSI Model :
An ISO standard that covers all aspects of network communications is Open
Systems Interconnection model. The Open systems Interconnection model is a
layered framework for the design of network system that allows for
communication across all type of computer systems. It consists of seven ordered
layers , each of which defines a segment of the process of moving information
across a network.
• Physical Layer
• Network Layer
• Transport Layer
• Session Layer
• Presentation Layer
• Application Layer
Physical Layer:
The physical layer coordinates the functions required to transmit a bit
stream over a physical medium. It deals with the mechanical and electrical
specifications of the interface and transmission medium. It also defines the
procedures and functions that physical devices and interfaces have to perform for
transmission to occur.
Transport Layer:
Presentation Layer:
Application Layer:
NETWORK MANAGEMENT
Broadcaster:
The broadcaster passes raw audio and video input through a bank of
MPEG-4 encoders to produce encoded streams in multiple resolutions. These are
then passed through an encryption module which keeps all the necessary
streaming headers in the clear and only encrypts the content in secure containers.
Video Store:
This component uses standard ISMA MPEG-4 hinting to store the different
stream resolutions under different hint tracks , each with metadata describing the
stream characteristics such as encoding rate, packet-loss sensitivity, etc. The
encryption module is then used to encrypt the content into secure containers. Since
such content is MPEG-4 complaint streaming server.
Streaming Server:
The Streaming Server receives data either from the broadcaster or form the
video store. The encryption of the media data is transparent to the server since it
only uses information in the hint-tracks or packet headers to stream the data. Data
is received from the broadcaster in the form of RTP packets over one of many
different transports: (i) multiplexed in one TCP channel in the RTSP-interleave
format,(ii) over multiple independent UDP unicast channels or (iii) over multiple
independent UDP multicast channels. In each case, a unique channel number
identifies packets belonging to a particular encoding. The server measures the
available bandwidth to each of its clients and forwards the most suitable channel
to the client. For TCP – based client connections, TCP-backpressure is used to
estimate the available rate and for RTP/UDP connections, RTCP feedback is used
to estimate the TCP-friendly rate. If the streamed bandwidth is well below the rate
requested by the client, then the server periodically attempts to increase the
bandwidth to the client by probing it with duplicate packets.
Client:
The client obtains the SDP describing the media and the encryption keys
from a Key Management system . The Video charger server is capable of
streaming MPEG-4 to any standards complaint client such as Apple Quick Time
6,Philips player, Cisco player and the IBM player. Among these, at the time of this
writing, only the IBM player implements the ISMA decryption standard.
MODULE 1:
Authentication:
The authentication process is used to verify whether the client
is authenticated or not. This process starts with the login screen, the user enters the
name and the password .This information will be sent to the server to check
whether the information is present in the database. If the information is matched
with the database the client will be authenticated and server gives rights for
communication otherwise an error message will be produced to the client.
MODULE 2:
The authenticated client will request for a media file, the server
checks whether the file exists in the local disk. This streaming consists of two sub
modules,
MODULE 4:
Splitting Video into Frames:
The video files are split into frames and each frame is encrypted using
AES and transmitted to client using RTP.
The audio and video files are merged together and decryption is
performed using AES, Finally the audio and media file are clubbed as a media file
and submitted to the client.
MODULE 5:
AES PROCESS:
• SUB BYTES
• SHIFT ROWS
• MIX COLUMNS
• ADD ROUND KEY
SUB BYTES:
Sub bytes are also known as S-box.In the SubBytes step, each
byte in the array is updated using an 8-bit S-box. This operation provides the non-
linearity in the cipher. The S-box is also chosen to avoid any fixed points , and
also any opposite fixed points.Each byte in the state is replaced with its entry in a
fixed 8-bit S; bij=S(aij).AES defines 16*16 matrix of byte values that contains 256
8-bit values.Each individual input byte is copied into a new byte in the following
way.The left most 4 bits of the byte are row value and the right most 4 bits are
column value.This row and column values serves as a indexes into tha S-box.By
using S-box values perform byte by byte substitution of the resultant matrix
SHIFT ROWS:
In the ShiftRows step, bytes in each row of the state are shifted
cyclically to the left. The number of places each byte is shifted differs for each
row.
The ShiftRows step operates on the rows of the state; it cyclically shifts the
bytes in each row by a certain offset. For AES, the first row is left unchanged.
Each byte of the second row is shifted one to the left. Similarly, the third and
fourth rows are shifted by offsets of two and three respectively. For the block of
size 128 bits and 192 bits the shifting pattern is same. In this way, each column of
the output state of the ShiftRows step is composed of bytes from each column
of the input state. (Rijndael variants with a larger block size have slightly different
offsets). In case of 256 bit block first row is unchanged and the shifting for
second, third and fourth row is 1 byte, 2 byte and 4 byte respectively - although
this change only applies for the Rijndael cipher when used with a 256-bit block,
which is not used for AES.
.
MIX COLUMNS:
The resultant matrix is taken from shift rows and multiply with the polynomial
matrix.In the MixColumns step, each column of the state is multiplied with a fixed
polynomial c(x).
In the MixColumns step, the four bytes of each column of the state are combined
using an invertible linear transformation. The MixColumns function takes four
bytes as input and outputs four bytes, where each input byte affects all four output
bytes. Together with ShiftRows, MixColumns provides diffusion in the
cipher.
ADD ROUND KEY:
In the AddRoundKey step, each byte of the state is combined with a byte
of the round subkey using the XOR operation (⊕).
In the AddRoundKey step, the subkey is combined with the state. For each
round, a subkey is derived from the main key using the key schedule; each subkey
is the same size as the state. Each round key is derived from the cipher key.The
subkey is added by combining each byte of the state with the corresponding byte
of the subkey using bitwise XOR.
5.2 DATA FLOW DIAGRAM:
AUTHENTICATION PROCESS:
Yes No
CLIENT-SERVER ARCHITECTURE
5.3 PROCESS DIAGRAM:
USE CASE DIAGRAM:
Login
Error message
Using AES
SEQUENCE DIAGRAM:
Client Audio Video Server Database
1.Login
2.Checks
3.If Valid
4.Authenticated
5.If Invalid
6.Error message
COLLABORATION DIAGRAM:
12: Both the files are decrypted
Client Audio
Video
2: Checks
Database
Server
ACTIVITY DIAGRAM:
Login
Server
if Invalid
Database
If Valid
Client
Authenticated
Error
message
Using AES
Audio andVideo files are
encrypted
Frames intopixels
Using AES
CLIENT:
package src;
class encryption
{
for(short k=0;k<=3;k++)
{
for(short l=0;l<=3;l++)
{
c[k][l]=(short)(state[k][l]^w[start][l]);
}
++start;
}
return c;
}
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
short temp1=(short) (state[i][j]/16);
short temp2=(short) (state[i][j]%16);
state[i][j]=S_box[temp1][temp2];
}
}
return(state);
}
state[1][i]=state[1][i+1];
state[1][3]=temp;
for(short i=0;i<4;i+=3)
{
short temp1=state[2][i];
state[2][i]=state[2][(i+2)%4];
state[2][(i+2)%4]=temp1;
}
short temp2=state[3][0];
state[3][0]=state[3][3];
state[3][3]=state[3][2];
state[3][2]=state[3][1];
state[3][1]=temp2;
return(state);
}
//s1=temp;
short a[]=new short[9];
for(i=0;i<=8;i++)
{
a[i]=(short)(temp%2);
temp= (short)(temp/2);
}
for(i=7;i>=1;i--)
{
t1=(short)(2<<(i-1));
t2=(short) ((t2+(a[i]*t1)));
}
i=7;
if(a[i]==0)
t1= (short)(t2^27);
else
t1=t2;
return(t1);
}
else if(p==3)
{
short i,t1,t2=0,temp,temp2;
temp2=s;
temp = (short) (s<<1);
}
i=7;
if(a[i]==0)
{
t1=(short) (t2^27);
t1= (short)(t1^temp2);
return(t1);
}
else
{
t1=(short)(t2^temp2);
return(t1);
}
}
else
return(s);
MIX COLUMN:
/*short state[][]={
{135,242,77,151},
{110,76,144,236},
{70,231,74,195},
{166,140,216,149}};*/
short poly_mat[][]={
{2,3,1,1},
{1,2,3,1},
{1,1,2,3},
{3,1,1,2}
};
short c[][]=new short[4][4];
for(short i=0;i<4;i++)
{
for(short j=0;j<4;j++)
{
for(short k=0;k<4;k++)
{
short temp1=(short) (poly_mult(poly_mat[i][k],state[k][j]));
c[i][j]=(short)((c[i][j]^temp1));
}
}
}
return(c);
}
state=SubBytes(state);
state=ShiftRows(state);
short j=40;
state=AddRoundKey(state,w,j);
return(state);
//out = state
}
KEY GENERATION:
class key_generation3
{
short S_box[][]={
{ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7,
0xab, 0x76},
{ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4,
0x72, 0xc0},
{ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8,
0x31, 0x15},
{ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27,
0xb2, 0x75},
{ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3,
0x2f, 0x84},
{ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c,
0x58, 0xcf},
{ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c,
0x9f, 0xa8},
{ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff,
0xf3, 0xd2},
{ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d,
0x19, 0x73},
{ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e,
0x0b, 0xdb},
{ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95,
0xe4, 0x79},
{ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a,
0xae, 0x08},
{ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd,
0x8b, 0x8a},
{ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1,
0x1d, 0x9e},
{ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55,
0x28, 0xdf},
{ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54,
0xbb, 0x16}};
short RCon[][] = {
{0x1,0,0,0},
{0x2,0,0,0},
{0x4,0,0,0},
{0x5,0,0,0},
{0x8,0,0,0},
{0x10,0,0,0},
{0x20,0,0,0},
{0x40,0,0,0},
{0x80,0,0,0},
{0x1b,0,0,0},
{0x36,0,0,0}};
for(short i=4;i<=43;i++)
{
short temp[]=new short[4];
for(short k=0;k<4;k++)
{
temp[k]=w[(i-1)][k];
if(i%4==0)
{
short j;
short temp1=temp[0];
for(j=0;j<3;j++)
{
temp[j]=temp[j+1];
temp[j]=temp1;
for(short m=0;m<=3;m++)
{
short temp2=(short) (temp[m]/16);
short temp3=(short) (temp[m]%16);
temp[m]=S_box[temp2][temp3];
}
for(short m=0;m<4;m++)
temp[m]=(short) (temp[m]^RCon[(i/4)-1][m]);
}
for(short m=0;m<4;m++)
w[i][m]=(short) (w[i-4][m]^temp[m]);
}
return(w);
}
class cipher
{
System.out.print(encrypt_data[i][j]+"\t");
System.out.println();
}*/
return encrypt_data;
}
}
DECRYPT IMAGE:
package src;
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.awt.image.MemoryImageSource;
import java.awt.image.PixelGrabber;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import javax.swing.ImageIcon;
import com.sun.image.codec.jpeg.ImageFormatException;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGEncodeParam;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
/* String msg="FINAL_0.avi";
String str[]={msg};
new Split(str);
*/
File f1=new File("enc-frames");
File file_arr[]=f1.listFiles();
// for(int z=0;z<1;z++){ //file_arr.length
// System.out.println("enc-frames/"+file_arr[z].getName());
short encrypt_data[][];
Image img=Toolkit.getDefaultToolkit().getImage("enc-
frames/enc_start3.jpeg");//+file_arr[z].getName());
ImageIcon imgico=new ImageIcon("enc-frames/enc_start3.jpeg");//
+file_arr[z].getName());
int imgwidth=imgico.getIconWidth();
int imgheight=imgico.getIconHeight();
int imgpixel[]; //=new int[imgwidth*imgheight];
int finalpixel[]=new int[imgwidth*imgheight];
if(imgwidth<0 || imgheight<0){
// continue;
}
boolean final_flag;
// PixelGrabber pg=new
PixelGrabber(img,0,0,imgwidth,imgheight,imgpixel,0,imgwidth);
System.out.println(imgwidth);
imgpixel=new
EncImgSerial().convertIntoIntFormat("enc_start3.jpegenc",imgwidth*imgheight);
System.out.println(imgpixel.length);
/* try {
pg.grabPixels();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}*/
String str=Integer.toBinaryString(255);
int value = Integer.parseInt(str, 2);
System.out.println(str);
System.out.println(value);
// System.out.println(""+(255*16));
short in[][]={
{00, 00, 00, 00},
{00, 00, 00, 00},
{00, 00, 00, 00},
{00, 00, 00, 00}};
int l=0;
boolean flag=false;
final_flag=false;
while(true){
flag=false;
final_flag=false;
for(int j=3;j>=0;j--){
for(int k=3;k>=0;k--){
if((in[j][k]+1)<256){
in[j][k]+=1;
flag=true;
break;
}
else{
in[j][k]=0;
}
}
if(flag)break;
}
System.out.println(imgpixel.length);
encrypt_data=new cipher().encData(in);
try{
for(int m=0;m<4;m++){
for(int n=0;n<4;n++){
finalpixel[l]=encrypt_data[m]
[n]^imgpixel[l];
System.out.println("final :"+finalpixel[l]
+"imgpixel :" +imgpixel[l]);
System.out.print("encrypt :
"+encrypt_data[m][n]+" ");
l++;
if(l==imgpixel.length){
final_flag=true;
break;
}
// System.out.println(finalpixel.toString());
}
// System.out.println();
if(final_flag)break;
}
}
catch(Exception e){
e.printStackTrace();
}
if(final_flag)break;
}
System.out.println("image started");
f = new FileOutputStream("dec-frames/enc_start3.jpeg");//
+file_arr[z].getName());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Graphics g = bi.createGraphics();
g.drawImage(img1,0,0,null);
g.dispose();
JPEGImageEncoder encoder =
JPEGCodec.createJPEGEncoder(f);
JPEGEncodeParam param =
encoder.getDefaultJPEGEncodeParam(bi);
// param.setQuality((float)((double)75 / 100D), true);
try {
encoder.encode(bi, param);
f.close();
} catch (ImageFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// }
}
}
SERVER:
package src;
import java.io.File;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
private Thread t;
private Receiver rec;
public Server(){
getContentPane().add(js);
rec= new Receiver();
t=new Thread(this);
t.start();
setSize(400,400);
setVisible(true);
}
public void run() {
// TODO Auto-generated method stub
while(true){
String msg=rec.receive();
System.out.println(msg);
write(msg);
//verify the username and password
if(msg.startsWith("Verify:")){
String str=msg;
String clientname = str.substring(str.indexOf(":")
+1,str.indexOf("/"));
boolean flag=new User_Verify().verify(msg);
if(flag){
new Response().sendRequest("true",clientname);
}
else{
System.out.println("Invalid UserName Password");
}
}
//send all media filenames to the client
else if(msg.startsWith("RequestAVI:")){
String str=msg;
String str1="";
String clientname = str.substring(str.indexOf(":")
+1,str.indexOf("/"));
File avi_files= new File("avi-files");
File arr_avi[]=avi_files.listFiles();
for(int i=0;i<arr_avi.length;i++){
str1+=arr_avi[i].getName()+",";
}
str1=str1.substring(0,str1.length());
new Response().sendRequest(str1,clientname);
}
//send the encrypted audio file
else if(msg.startsWith("RequestAudio:")){
String str=msg;
String clientname = str.substring(str.indexOf(":")
+1,str.indexOf("/"));
new EncryptAudio().encryptValues(clientname);
// new Response().encryptedAudioSend("enc-
aud/encrypted_aud.wavser",clientname);
}
//send all splitted and encrypted files
else if(msg.startsWith("RequestVideo:")){
String str=msg;
String clientname = str.substring(str.indexOf(":")
+1,str.indexOf("/"));
msg=msg.substring(msg.lastIndexOf(":")+1,msg.length());
String str1[]={msg};
new Split(str1);
new SelectorDemo1("split-
vid0.mov").convertImageArray();
new CreateEncryptImage(clientname);
// new Response().encryptedAudioSend("enc-
aud/encrypted_aud.wavser","system2");
}
}
}
public static void write(String str) {
ta.append("\n"+str);
}
public static void main(String args[]){
new Server();
}
}
package src;
class encryption
{
for(short k=0;k<=3;k++)
{
for(short l=0;l<=3;l++)
{
c[k][l]=(short)(state[k][l]^w[start][l]);
}
++start;
}
return c;
}
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
short temp1=(short) (state[i][j]/16);
short temp2=(short) (state[i][j]%16);
state[i][j]=S_box[temp1][temp2];
}
}
return(state);
state[1][i]=state[1][i+1];
state[1][3]=temp;
for(short i=0;i<4;i+=3)
{
short temp1=state[2][i];
state[2][i]=state[2][(i+2)%4];
state[2][(i+2)%4]=temp1;
}
short temp2=state[3][0];
state[3][0]=state[3][3];
state[3][3]=state[3][2];
state[3][2]=state[3][1];
state[3][1]=temp2;
return(state);
}
//s1=temp;
short a[]=new short[9];
for(i=0;i<=8;i++)
{
a[i]=(short)(temp%2);
temp= (short)(temp/2);
}
for(i=7;i>=1;i--)
{
t1=(short)(2<<(i-1));
t2=(short) ((t2+(a[i]*t1)));
}
i=7;
if(a[i]==0)
t1= (short)(t2^27);
else
t1=t2;
return(t1);
}
else if(p==3)
{
short i,t1,t2=0,temp,temp2;
temp2=s;
temp = (short) (s<<1);
}
i=7;
if(a[i]==0)
{
t1=(short) (t2^27);
t1= (short)(t1^temp2);
return(t1);
}
else
{
t1=(short)(t2^temp2);
return(t1);
}
}
else
return(s);
}
/*short state[][]={
{135,242,77,151},
{110,76,144,236},
{70,231,74,195},
{166,140,216,149}};*/
short poly_mat[][]={
{2,3,1,1},
{1,2,3,1},
{1,1,2,3},
{3,1,1,2}
};
short c[][]=new short[4][4];
for(short i=0;i<4;i++)
{
for(short j=0;j<4;j++)
{
for(short k=0;k<4;k++)
{
short temp1=(short) (poly_mult(poly_mat[i][k],state[k][j]));
c[i][j]=(short)((c[i][j]^temp1));
}
}
}
return(c);
}
public short[][] encryp_process(short in[][], short w[][])
{
state=SubBytes(state);
state=ShiftRows(state);
short j=40;
state=AddRoundKey(state,w,j);
return(state);
//out = state
}
class key_generation3
{
short S_box[][]={
{ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7,
0xab, 0x76},
{ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4,
0x72, 0xc0},
{ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8,
0x31, 0x15},
{ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27,
0xb2, 0x75},
{ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3,
0x2f, 0x84},
{ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c,
0x58, 0xcf},
{ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c,
0x9f, 0xa8},
{ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff,
0xf3, 0xd2},
{ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d,
0x19, 0x73},
{ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e,
0x0b, 0xdb},
{ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95,
0xe4, 0x79},
{ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a,
0xae, 0x08},
{ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd,
0x8b, 0x8a},
{ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1,
0x1d, 0x9e},
{ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55,
0x28, 0xdf},
{ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54,
0xbb, 0x16}};
short RCon[][] = {
{0x1,0,0,0},
{0x2,0,0,0},
{0x4,0,0,0},
{0x5,0,0,0},
{0x8,0,0,0},
{0x10,0,0,0},
{0x20,0,0,0},
{0x40,0,0,0},
{0x80,0,0,0},
{0x1b,0,0,0},
{0x36,0,0,0}};
for(short i=4;i<=43;i++)
{
short temp[]=new short[4];
for(short k=0;k<4;k++)
{
temp[k]=w[(i-1)][k];
if(i%4==0)
{
short j;
short temp1=temp[0];
for(j=0;j<3;j++)
{
temp[j]=temp[j+1];
temp[j]=temp1;
for(short m=0;m<=3;m++)
{
short temp2=(short) (temp[m]/16);
short temp3=(short) (temp[m]%16);
temp[m]=S_box[temp2][temp3];
}
for(short m=0;m<4;m++)
temp[m]=(short) (temp[m]^RCon[(i/4)-1][m]);
}
for(short m=0;m<4;m++)
w[i][m]=(short) (w[i-4][m]^temp[m]);
}
return(w);
}
class cipher
{
System.out.print(encrypt_data[i][j]+"\t");
System.out.println();
}*/
return encrypt_data;
}
}
DECRYPT IMAGE:
package src;
import java.io.File;
import java.io.FileNotFoundException;
import javax.swing.ImageIcon;
public CreateDecryptImage(){
f1=new File("rec_enc_frames");
file_arr=f1.listFiles();
System.out.println("No of files" +file_arr.length);
if(file_arr.length>0){
System.out.println(file_arr[0].getName());
if(file_arr[0].getName().equals("Thumbs.db")){
imgico=new
ImageIcon("rec_enc_frames/"+file_arr[1].getName());//"split-frames/start3.jpeg");
}
else{
imgico=new
ImageIcon("rec_enc_frames/"+file_arr[0].getName());//"split-frames/start3.jpeg");
}
imgwidth=imgico.getIconWidth();
imgheight=imgico.getIconHeight();
decImage();
}
}
//Decrypt all frames
public void decImage(){
for(int z=0;z<file_arr.length;z++){
try{
new
DecryptImage(imgwidth,imgheight).decryptFrames(file_arr[z].getName());
}
catch(Exception e){
e.printStackTrace();
}
}
}
public static void main(String args[]){
new CreateDecryptImage();
}
}
DECRYPT AUDIO:
package src;
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.awt.image.MemoryImageSource;
import java.awt.image.PixelGrabber;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import com.sun.image.codec.jpeg.ImageFormatException;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGEncodeParam;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
public DecryptAudio(){
ll=new LinkedList();
en=new EncAudSerial();
ll_temp=new LinkedList();
}
public void decryptValues() {
// TODO Auto-generated method stub
try {
int temp;
int aud_pixel_incre=0;
// fin = new FileInputStream("enc-aud/encrypted_aud.wav");
// buffer_size = fin.available();
audpixel=en.convertIntoIntFormat("enc-
aud/encrypted_aud.wavser");//new int[buffer_size];
finalpixel=new int[audpixel.length];
aud_pixel_length=audpixel.length;
System.out.println(aud_pixel_length);
f = new FileOutputStream("dec-aud/decrypted_aud.wav");
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String str=Integer.toBinaryString(255);
value = Integer.parseInt(str, 2);
System.out.println(str);
System.out.println(value);
short in[][]={
{00, 00, 00, 00},
{00, 00, 00, 00},
{00, 00, 00, 00},
{00, 00, 00, 00}};
l=0;
flag=false;
final_flag=false;
//dynamic valud gen
while(true){
flag=false;
final_flag=false;
for(int j=3;j>=0;j--){
for(int k=3;k>=0;k--){
if((in[j][k]+1)<256){
in[j][k]+=1;
flag=true;
break;
}
else{
in[j][k]=0;
}
}
if(flag)break;
}
//encrypt given dynamic mat
encrypt_data=new cipher().encData(in);
try{
for(int m=0;m<4;m++){
for(int n=0;n<4;n++){
finalpixel[l]=audpixel[l]^encrypt_data[m][n];
// ll.add(String.valueOf(finalpixel[l]));
//
ll_temp.add(String.valueOf(finalpixel[l]));
// System.out.println(ll);
f.write(finalpixel[l]);
System.out.println(finalpixel[l]);
l++;
if(l==aud_pixel_length){
final_flag=true;
break;
}
}
// System.out.println();
if(final_flag)break;
}
// System.out.println(ll_temp.toString());
}
catch(Exception e){
e.printStackTrace();
break;
}
if(final_flag)break;
send_req_incre++;
}
System.out.println("size"+finalpixel.length);
}
public static void main(String args[]){
new DecryptAudio().decryptValues();
}
}
LOGIN:
package src;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
v=new Verify();
setSize(360,125);
setVisible(true);
}
public static void main(String args[]){
new Login();
}
}
5.6 SAMPLE INPUT AND OUTPUT:
TYPE OF TESTING:
The various types of testing are
White Box Testing
Black Box Testing
Alpha Testing
Beta Testing
Win Runner And Load Runner
Load Runner
Alpha testing is the software prototype stage when the software is first able
to run. It will not have all the intended functionality, but it will have core
functions and will be able to accept inputs and generate outputs. An
alpha test usually takes place in the developer's offices on a separate
system.
BETA TESTING:
We use Win Runner as a load testing tool operating at the GUI layer as it allows
us to record and playback user actions from a vast variety of user applications
as if a real user had manually executed those actions.
With Load Runner , you can Obtain an accurate picture of end-to-end system
performance. Verify that new or upgraded applications meet specified
performance requirements.
6.1.1 TESTING USED IN THIS PROJECT:
6.1.2 SYSTEM TESTING :
TEST CASE 1
MODULE 1: (AUTHENTICATION)
Primary goal:
The acts as a server gets the splited packet from the client .
Input:
Only an authenticated client can activate
Process:
This process starts with a login screen , the user enters the name and
password. The information is checked with the database. If the information is
matched with database the client will be authenticated and the server gives rights
for authentication otherwise an error message is produced to the client
Output:
The server gives rights for authentication otherwise an error message is
produced to the client
Input:
Authenticated client will request for a media file.
Process:
The server checks whether the file exist in a local disk or not.
Output:
Splits the audio file into audio and video.
Process:
The media file is first splited into audio and video files separately the
client receives both audio and video files.
Output:
The encrypted audio is divided into packets and sent to the client using
RTP and the video is captured by video capturing unit.
Process:
Audio and video files encrypted using AES and transmitted to the client
using RTP.
Output:
The audio and video files are merged together and decryption is performed
using AES, finally the audio and video files are clubbed as a media file and given
to the client.
FUTURE
ENHANCEMENT
7. FUTURE ENHANCEMENT:
Media files can be transferred with secure and less packet loss.Bi –Directional process
can be performed. Audio files are encrypted and divided into packets. Video files are
separated into frames then into pixels.
One Server can act as a multiple clients.Transformation time for frames can
be reduced.Even if power fails, there is no data loss and stored in data base.
TheARMS system architecture witha focus on the extensions to the ISMA
security standard to enableadaptative streaming of encrypted MPEG-4
content. The systemis designed to address the requirements of typical
enterprise media streaming systems. Although we have addressed many
challenges in building this system, there are many more problems yet to be
solved. We are investigating various optimizations in the coding and
streaming to improve the bandwidth utilization while minimizing the
distortion experienced by the clients in wired and wireless networks.
CONCLUSION
8.CONCLUSION:
BOOKS:
WEBSITE:
http://csrc.nist.gov/encryption/aes/index.html