Final Doc New

Preview:

Citation preview

ABSTRACT

The main aim of this project to remove the problems faced by

the streaming media, the server sends a media file to clients with secure and with

less packet loss.

The objective of this project is to provide a quality of service to

streaming media, which gives the solution of streaming media, faced problems.

Securing and authenticating media files use cipher and ISMA standard specified

RTP. Using this media file can be transfer with secure and with less packet loss.

The main motivation of the Securing and Authenticating Media

Files System is to remove the streaming media faced problems. Such as network

infrastructure that can not accommodate a secure and real time nature of streaming

content , components can not adapt to varying network conditions and no

standardized streaming formats. The securing and authenticating is an important

field in the streaming media. The main motivation is to provide the authenticated

client only have the rights to access the media file , the server adapts a stream even

though the network conditions automatically changed , adapts a stream to

available bandwidth and without packet loss it sends the voluminous streams to

client and the ISMA (Internet Streaming Media Alliance ) standardization provide

the end-to-end security model.

TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO.

ABSTRACT

LIST OF TABLES

1 INTRODUCTION

1.1 SYNOPSIS1.2 SCOPE OF THE PROJECT1.3 PROJECT FEATURES

2 SYSTEM STUDY 2.1 EXISTING SYSTEM

2.2 PROPOSED SYSTEM 2.3 FEASABILITY STUDY 2.4 OBJECTIVE

3 SYSTEM SPECIFICATION 3.1 HARDWARE SPECIFICATION3.2 SOFTWARE SPECIFICATION

4 LANGUAGE DESCRIPTION

5 SYSTEM DESIGN AND DEVELOPMENT 5.1 DESCRIPTION 5.2 DATA FLOW DIAGRAM 5.3 PROCESS DIAGRAM 5.4 SCREEN DESIGN 5.5 SAMPLE CODING 5.6 SAMPLE INPUT AND OUTPUT

6 TESTING AND IMPLEMENTATION 6.1 SYSTEM TESTING 6.2 IMPLEMENTATION TESTING 6.3 SYSTEM IMPLEMENTATION

7 FUTURE ENHANCEMENT 8 CONCLUSION

9 LIST OF REFERENCE

LIST OF TABLES

TA.NO. TABLE NAME PAGE NO

4 SWING COMPONENT CLASSES

6.1.1 TEST REPORT

6.1.2 VALIDATION TESTING

INTRODUCTION

1.INTRODUCTION:

This project removes the problems faced by streaming media without

packet loss. Many enterprises use streaming video to convey news clips or

corporate communications to their employees or clients. However,since the

networks are based on packet-switching technology which is designed for data

communication, achieving efficient distribution of streaming video and

multimedia to a wide heterogeneous user population poses many technical

challenges.

Besides the standard video-over-IP issues, enterprises have additional

requirements due to the need to control a shared infrastructure where business

media comes first. In addition to challenges in terms of video coding and

networking, one of the key requirements for enterprise streaming is clearly posed

in terms of security. The video distribution has to be efficient and to adapt to the

clients requirements, while at the same time offering a high degree of security

through proper authentication, authorization and encryption techniques.

1.1 SYNOPSIS:

The main aim of this project to remove the problems faced by

the streaming media, the server sends a media file to clients with secure and with

less packet loss.

The objective of this project is to provide a quality of service to

streaming media, which gives the solution of streaming media, faced problems.

Securing and authenticating media files use cipher and ISMA standard specified

RTP. Using this media file can be transfer with secure and with less packet loss.

The main motivation of the Securing and Authenticating

Media Files System is to remove the streaming media faced problems. Such as

network infrastructure that can not accommodate a secure and real time nature of

streaming content , components can not adapt to varying network conditions and

no standardized streaming formats. The securing and authenticating is an

important field in the streaming media. The main motivation is to provide the

authenticated client only have the rights to access the media file , the server adapts

a stream even though the network conditions automatically changed , adapts a

stream to available bandwidth and without packet loss it sends the voluminous

streams to client and the ISMA (Internet Streaming Media Alliance )

standardization provide the end-to-end security model.

1.2 SCOPE OF THE PROJECT:

The system is effectively used in out sourcing service(BPO),

Network in LAN connection. Data consists of text, documents, image are

transmitted through network, which increases the packet transmission that led to

increases the traffic. So traffic is nothing but increasing the packet information that

information should be analysis and displays it graphically. It is a network based

project and it reduces the network traffic which transfer the speed.

Let us take an example the Network is work based on the client

server communication. Client means placing a request (i.e.) client is a running

application programs on a local site that requests service from a running

application program on a remote site. Server means a program that can provide

services to others program.

Network consists of two types of connections.

They are Physical connection and Logical connection.

1. Physical connection:

Whenever the computer are interconnect physically

(i.e.) connection through cables, cards is called physical

connection.

2. Logical connection:

Even though the computer are interconnect, the user

have to log on to the computer, which is called logical

connection.

In this logical connection, whenever client server

communication takes place, traffic between client server will be

increased.

1.3 PROJECT FEATURE :

Secured data transfer of media files.

Only Authenticated client can access the transferred media files.

There is no data loss during transmission so at receiving end the media file

can view with maximum quality.

It is possible to transfer this media file to more than one destination

securely at the same time.

Having enough CPU power and bus bandwidth to support the required data

rates.

AES ALGORITHM:

It stands for Advanced Encryption Standard.

AES is a symmetric key encryption technique will replace a commonly

used Data 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:

In existing system, media file compression takes place. Both

audio and video files are compressed and sent through the network. Maximum

compressing of data is possible. For example , sending a movie file. If the file size

is more it takes more time to transmit the data.

The file is encrypted, the data’s are compressed and then

decrypted. Finally the original file is obtained. When the entire file is sent data

loss takes place. When the whole file is sent, there wont be any proper

acknowledgement. So, the file is not secured. The user can only access

presentations while they're in-progress. When single algorithm is used for both

audio and video file data mixing is done or the output is not capable for the

reconstruction.

2.2PROPOSED SYSTEM:

The proposed system consists of many enhancement of the existing

system.

This System is used to remove the problems faced by the streaming

media,the server sends a media file to clients with secure and with out packets

loss.

The Proposed system provides a quality of service to streaming

media,which gives the solution for streaming media faced problems.Securing and

authenticating media files use the stream cipher and ISMA standard specified

RTP.Using this media file can be transfer with secure and with out packet loss.

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.

The following feasibility techniques has been used in this project

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 :

The objectives of this project is to provide a quality of service to

streaming media, which gives the solution of streaming media, faced problems.

Securing and authenticating media files use cipher and ISMA standard specified

RTP. Using this media file can be transfer with secure and with less packet loss.

The Audio/Video Transport Working Group was formed to specify a

protocol for real-time transmission of audio and video over unicast and multicast

UDP/IP. This is the Real-time Transport Protocol, RTP, together with its

associated profiles and payload formats.

The current aim is to develop the mechanisms needed for efficient

control of media and its encoding process in RTP based conferencing, both over

multicast and transport containing relays, translators and mixers. An example of

such a mechanism is a method to request a full intra coded frame of video. This

would be used to allow joining participants to receive video immediately after

joining instead of waiting for the next intra coded frame. It also allows mixers to

perform switching between media sources without the need to re-encode the

media.

SYSTEM SPECIFICATION

3. SYSTEM SPECIFICATION

3.1 HARDWARE SPECIFICATION:

Processor : Pentium-III

Speed : 1.1GHz

RAM : 512MB

Hard Disk : 40GB

General : KeyBoard, Monitor , Mouse

3.2 SOFTWARE SPECIFICATION:

Operating System : Windows XP/Windows 2000

Software : JMF , JAVA ( JDK 1.5.0)

Protocol : UDP

LANGUAGE DESCRIPTION

4. LANGUAGE DESCRIPTION

The inventors are java wanted to design a language, which could

offer solution to some of the problems encountered in modern programming. They

wanted the language to be reliable, portable and distributed but also simple,

compact and interactive. Sun Microsystems officially describes java with

following attributes:

Compile and interpreter

Platform independent and portable

Object-oriented

Distributed

Familiar ,simple and small

Multithreaded and interactive

High performance

Dynamic and extensible

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.

Compile and Interpreted:

Usually a computer language either compiled or interpreted. Java

combines both the approaches for making java a two-stage system. First, Java

compiler translates source code into what is known as byte code instructions.

Byte codes are not machine instructions is therefore , in the second stage, java

interpreter generates machine code that

can be directly executed by a machine is running the Java program. We can

thus say that a Java is both compiled and an interpreted language.

Platform-Independent and Portable:

The most significant contribution of Java over other languages is its

portability. Java programs can be easily moved from one computer system to

another, anywhere anytime. Changes and upgrades in operating systems,

processors and system resources will not force any changes in Java programs. This

is the reason why Java has become a popular language for programming on

Internet, which interconnects different kinds of systems worldwide.We can

download a Java applet from a remote computer on to our local system via Internet

an extension of the user’s basic system providing practically unlimited number of

accessible applets and applications.

Java ensures the portability in two ways. First Java compiler generate

byte code instructions that can be implemented on any machine. Secondly, the size

of the primitive data types are machine-independent.

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:

Java is a robust language. It provides many safeguards to ensure reliable

code. It has strict compiler time and runtime checking for data types. It is

designed as a garbage-collected language relieving the programmers virtually

all memory management problems. Java also incorporates the concept of

exception handling , which captured the series errors and eliminates any risk of

crashing the system.

Security becomes an important issue for a language that is used for

programming in internet. Threat of virus and abuse of resource is everything.

Java systems not only verify all memory access but also ensure no virus are

communicated with an applet. The absence of pointer in java ensures that

programs cannot gain access to memory location without proper authorization.

Distributed:

Java is designed as a distributed language for creating applications on

networks.It has the ability to share both data programs. Java applications can open

and access remote objects on Internet as easily as they can in a local system.This

enables multiple programmers at multiple remote locations to collaborate and

work together on a single project.

Simple Small and Familiar:

Java is a small and simple language. Many features of C and C++ that are

either redundant or sources of unreliable code are not part of Java. For example,

Java does not use pointers,preprocessor header files, go to statement and

many others.It also eliminates operator overloading and multiple inheritance.

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++.

Mutithreading and Interactive:

Multi threaded means handling multiple tasks simultaneously. Java

supports multi threading programs. This means that we need not wait for the

application to finish one task before beginning another. For example. we can listen

to an audio clip time download an applet from distance computer. The feature

greatly improves the interactive performance of graphical applications. The Java

runtime comes with tools that support multi process synchronization and construct

smoothly running interactive system.

High Performance:

Java performance is impressive for an interpreted language. Mainly due to

the use of intermediate byte code. According to Sun, java speed is comparable to

the native C/C++. Java architecture is also designed to reduce overhead during

runtime. Further, the incorporation of multi threading enhances the overall

execution speed of overall programs.

Dynamic and Extensible:

Java is a dynamic language . Java is capable of dynamically linking in new

class libraries methods and objects. Java can also determine the type of class

through a query, making it possible to either dynamically link or abort the program

, depending on the response.

Java programs support functions written in other languages such as C and

C++.These functions are known as native methods.This facility enables

The programmers to use the efficient functions available in these languages.Native

methods are linked dynamically at runtime.

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

JApplet The swing version of Applet

JButton The Swing Push Button class

JCheckBox The swing CheckBox class

JComboBox Encapsulates a combobox

JLabel The swing version of a Label

JRadioButton The swing version of a RadioButton

JScrollPane Encapsulates a scrollable window

JTabbedPane Encapsulates a Tabbed window

JTable Encapsulates a Table-based control

JTextField The swing version of a text-field

SYSTEM DESIGN AND DEVELOPMENT

5. SYSTEM DESIGN AND DEVELOPMENT:

5.1 DESCRIPTION OF A SYSTEM:

Network: A Network is a set of devices (often referred to as nodes) connected by

media links. A node can be a computer ,Printer, or any other device capable of

sending and/or receiving data generated by other nodes on thenetwork. The links

connecting the devices are often called communication Channels.

Distributed Processing:

Network use distributed Processing , in which a task is divided among

multiple computers.

Advantages of distributed processing included the following.

Security/encapsulation.

Distributed databases.

Faster problem solving.

Security through redundancy.

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.

The seven layers are:

Physical Layer

Data Link Layer

Network Layer

Transport Layer

Session Layer

Presentation Layer

Application Layer

Functions of the Layers :

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.

Data Link Layer:

The data link layer transforms the physical layer, a raw transmission

facility, to a reliable link and is responsible for node-to-node delivery . It makes

the physical layer appear error free to the network layer. The data link

layer divides the stream of bits received from the network layer into manageable

data units called frames. The data link layer adds a header to the frame to define

the physical address of the sender or receiver of the frame.

Network Layer:

The network layer is responsible for the source-to-destination delivery of

a packet possibly across multiple networks. The network layer ensures that each

packet gets from its point of origin to its final destination.

The network layer includes the logical addresses of the sender and receiver.

Transport Layer:

The transport layer is responsible for source –to-destination delivery of

the entire message. The network layer oversees end-end delivery of individual

packets; it does not recognize any relationship between those packets . It treats

each one independently. The transport layer creates a connection between the two

end ports . A connection is a single logical path between the source and

destination that is associated with all packets in a message . In this layer the

message is divided into transmittable segment containing a sequence number.

Session Layer:

The Session layer is the network dialog controller. It establishes,

maintains, and synchronizes the interaction between communicating systems. The

session layer allows a process to add checkpoints into a stream of data.

Presentation Layer:

The Presentation layer is concerned with the syntax and semantics of

the information exchange between two systems. The processes in two systems are

usually exchanging information in the form of character strings, numbers and so

on. The information should be changed to bit streams before being transmitted.

The presentation layer is responsible for interoperability between these different

encoding method. The presentation layer at the sender changes the information

from its sender-dependent format into a common format.

Application Layer:

The Application layer enables the user, whether human or software, to

access the network. A network virtual terminal is a software version of a physical

terminal and allows a user to log on to a remote host.

A client is defined as a requester of services and a server is defined as

the provider of services. A single machine can be both a client and a server

depending on the software configuration.

NETWORK MANAGEMENT

5.1.1 Client/Server Architecture :

In this architecture we describe how the secure streaming technique

is used in the end-to-end ARMS system. The main components of the architecture

are illustrated . he components consist of the broadcaster which is the source of

encrypted content, packaged for adaptation, the Video Store to store the possibly

multiply encoded content , the Streaming Server which uses a simple and efficient

stream-switching technique for adaptation, and finally the playback clients. The

figure illustrates a simple configuration with one instance of each of the main

components. In large scale deployments , the streaming servers can be networked

for distribution and there can be multiple Broadcasters and Video Stores.

Client/Server Architecture

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.

5.1.2 TWO- TIER ARCHITECTURE:

With two tier client/server architectures, the user system

interface is usually located in the user’s desktop environment and the database

management services are usually in a server that is a more powerful machine

that services many clients. Processing management is slit between the user

system interface environment and the database management server

environment.

The two-tier client/server architecture is a good solution for

distributed computing when work groups are defined as a dozen to 100 people

interacting on a LAN simultaneously.

Consider the 100 people are interacted in the LAN

Network. While they communicating with each other data transmission

between them increases on that time the proposed system help to find out

traffic and reroute the traffic into other paths.

MODULE DESCRIPTION:

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:

Client-server architecture for video streaming:

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,

1. Splitting the file into audio and video,

2. Splitting the video file into frames.

MODULE 3:

Splitting into Audio and Video:

The media file is first splitted into audio and video files separately.

The client receives both audio and video files. The audio file is encrypted using

AES in the server side, the encrypted audio is divided into packets and sent to

client using RTP and the video is captured by video capturing unit.

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:

PROJECT CONCEPT DIAGRAM:

AUTHENTICATION PROCESS:

Yes No

CLIENT-SERVER ARCHITECTURE

5.3 PROCESS DIAGRAM:

USE CASE DIAGRAM:

Login

Checks the database

Authenticated

Error message

Audio and video files

Audio and video files are encrypted

Frames into pixels

Client

Both the files are decrypted

Server

Valid

InvalidRequest

Using AES

Using AES

SEQUENCE DIAGRAM:

12.Both the files are decrypted Using AES

Client Audio Video Server Database

1.Login

2.Checks

3.If Valid

4.Authenticated

5.If Invalid

6.Error message

7.Request for Audio and Video files

8.Encrypted Using AES

9.Encrypted Using AES

10.Splits into frames

11.Frames into Pixels

COLLABORATION DIAGRAM:

Database

Client Audio

Video

Server

1:

2:

3:

4:

5:

6:

7:

8:

9: 10: 11:

12:

Login

Checks

If Valid

AuthenticatedIf Invalid

Error messageRequest for files

Encrypt the file

Encrypt the fileSplits into frames Frames into Pixels

Both the files are decrypted

ACTIVITY DIAGRAM:

Login

Server

Database

Client Authenticated

Request for Audio and video files

Audio and Video files are encrypted

Video file splits into frames

Frames into pixels

Both the files are decrypted

If Valid

Using AES

Using AES

Error message

if Invalid

5.3 SCREEN DESIGN:

LOGIN

INVALID

OPENING MAIN FRAMES

RECEIVING FILE NAME

CLIENT- SERVER

SERVER PROCESS

SERVER ENCRYPTION

MERGING THE FILE

5.4 SAMPLE CODING:

CLIENT:

package src;

class encryption{

private static 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}};

ADD ROUND KEY:

public short[][] AddRoundKey(short state[][],short w[][],short start){

//if(start<=end)//{

short c[][]=new short[4][4];

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;}

public short[][] SubBytes(short state[][]){

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);

}

public short[][] ShiftRows(short state[][]){ short temp=state[1][0]; for(short i=0;i<3;i++) 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);}

public short poly_mult(short p,short s){

if(p==2) { short i,t1,t2=0,temp; temp = (short) (s<<1);

//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);

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);

t1= (short)(t1^temp2);

return(t1); }

else { t1=(short)(t2^temp2);

return(t1); }

}

else return(s); }

MIX COLUMN:

public short[][] MixColumns(short state[][]) {

/*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[][]){

short state[][]= new short[4][4];state = in;short i=0;state=AddRoundKey(state, w,i); for(short round=1;round<=9;round++)

{state=SubBytes(state);state=ShiftRows(state); state=MixColumns(state);state=AddRoundKey(state,w,(short)(round*4)); }

state=SubBytes(state);state=ShiftRows(state);short j=40;state=AddRoundKey(state,w,j); return(state);//out = state}

}

KEY GENERATION:

class key_generation3{

public short[][] KeyExpansion3(short key[][]){ 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 w[][]=new short[44][4]; for(short i=0;i<4;i++)

{for(short j=0;j<4;j++){w[i][j]=key[i][j];

}

}

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{

public short[][] encData(short in[][]) { short inputdata[][]=in;/* short inputdata[][]={ {0x32, 0x43, 0xf6, 0xa8}, {0x88, 0x5a, 0x30, 0x8d}, {0x31, 0x31, 0x98, 0xa2}, {0xe0, 0x37, 0x07, 0x34}};*/// System.out.println("the original data"); /* for(short i=0;i<4;i++) { for(short j=0;j<4;j++) System.out.print(inputdata[i][j]+"\t"); System.out.println(); }*/ short cipherkey[][]={ {0x2b, 0x7e, 0x15, 0x16}, {0x28, 0xae, 0xd2, 0xa6}, {0xab, 0xf7, 0x15, 0x88}, {0x09, 0xcf, 0x4f, 0x3c}};

key_generation3 k=new key_generation3(); short key_exp[][]=new short[44][4]; key_exp=k.KeyExpansion3(cipherkey);

/*System.out.println("the key expansion result"); for(short i=0;i<=43;i++) { for(short j=0;j<4;j++) System.out.print(key_exp[i][j]+"\t"); System.out.println(); }*/

encryption enc=new encryption(); short encrypt_data[][]=new short[4][4]; encrypt_data=enc.encryp_process(inputdata,key_exp);

// System.out.println("the encryption data");/* for(short i=0;i<4;i++)

{ for(short j=0;j<4;j++) 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;

public class DecryptImage {

/** * @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 blocke1.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");

Image img1=new Applet().createImage(new MemoryImageSource(imgwidth,imgheight,finalpixel,0,imgwidth));

BufferedImage bi = new BufferedImage(imgwidth,imgheight,1);FileOutputStream f = null;try {

f = new FileOutputStream("dec-frames/enc_start3.jpeg");//+file_arr[z].getName());

} catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.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 blocke.printStackTrace();

} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();

}// }

}}

SERVER:package src;

import java.io.File;

import javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JTextArea;

public class Server extends JFrame implements Runnable {

public static JTextArea ta=new JTextArea();public static JScrollPane js=new JScrollPane(ta);

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 stubwhile(true){

String msg=rec.receive();System.out.println(msg);write(msg);//verify the username and passwordif(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 clientelse 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 fileelse 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{

private static 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}};

public short[][] AddRoundKey(short state[][],short w[][],short start){//if(start<=end)//{

short c[][]=new short[4][4];

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;}

public short[][] SubBytes(short state[][]){

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);

}

public short[][] ShiftRows(short state[][]){ short temp=state[1][0]; for(short i=0;i<3;i++) 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);}

public short poly_mult(short p,short s){

if(p==2) { short i,t1,t2=0,temp; temp = (short) (s<<1);

//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);

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);

t1= (short)(t1^temp2);

return(t1); }

else { t1=(short)(t2^temp2);

return(t1); }

}

else return(s); }

public short[][] MixColumns(short state[][]) {

/*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[][]){

short state[][]= new short[4][4];state = in;short i=0;

state=AddRoundKey(state, w,i); for(short round=1;round<=9;round++){state=SubBytes(state);state=ShiftRows(state); state=MixColumns(state);state=AddRoundKey(state,w,(short)(round*4)); }

state=SubBytes(state);state=ShiftRows(state);short j=40;state=AddRoundKey(state,w,j); return(state);//out = state}

}

class key_generation3{

public short[][] KeyExpansion3(short key[][]){ 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 w[][]=new short[44][4]; for(short i=0;i<4;i++)

{for(short j=0;j<4;j++){w[i][j]=key[i][j];

}

}

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{ public short[][] encData(short in[][]) { short inputdata[][]=in;/* short inputdata[][]={ {0x32, 0x43, 0xf6, 0xa8}, {0x88, 0x5a, 0x30, 0x8d}, {0x31, 0x31, 0x98, 0xa2}, {0xe0, 0x37, 0x07, 0x34}};*/// System.out.println("the original data"); /* for(short i=0;i<4;i++) { for(short j=0;j<4;j++) System.out.print(inputdata[i][j]+"\t"); System.out.println(); }*/ short cipherkey[][]={ {0x2b, 0x7e, 0x15, 0x16}, {0x28, 0xae, 0xd2, 0xa6}, {0xab, 0xf7, 0x15, 0x88}, {0x09, 0xcf, 0x4f, 0x3c}};

key_generation3 k=new key_generation3(); short key_exp[][]=new short[44][4]; key_exp=k.KeyExpansion3(cipherkey);

/*System.out.println("the key expansion result"); for(short i=0;i<=43;i++) { for(short j=0;j<4;j++) System.out.print(key_exp[i][j]+"\t"); System.out.println(); }*/

encryption enc=new encryption(); short encrypt_data[][]=new short[4][4]; encrypt_data=enc.encryp_process(inputdata,key_exp);

// System.out.println("the encryption data");/* for(short i=0;i<4;i++) { for(short j=0;j<4;j++) 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 class CreateDecryptImage {private File f1;private File file_arr[];private ImageIcon imgico;private int imgwidth;private int imgheight;

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 framespublic 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 class DecryptAudio {/** * @param args

*/private LinkedList ll;private LinkedList ll_temp;private EncAudSerial en;private Image img;private Image img1;

private FileInputStream fin;private FileOutputStream f = null;private PixelGrabber pg;private BufferedImage bi;private Graphics g;private JPEGEncodeParam param;private JPEGImageEncoder encoder;private short encrypt_data[][];private int imgwidth;private int imgheight;private int audpixel[];private int finalpixel[];private int l;private int value;private int send_req_incre=0;private int times_of_send=0;private boolean final_flag;private boolean flag;private int buffer_size;private int aud_pixel_length;private byte[] buffer;

public DecryptAudio(){ll=new LinkedList();en=new EncAudSerial();

ll_temp=new LinkedList();}public void decryptValues() {

// TODO Auto-generated method stubtry {

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 blocke1.printStackTrace();

} catch (IOException e) {// TODO Auto-generated catch blocke.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 genwhile(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;

public class Login extends JFrame implements ActionListener{/** * */private static final long serialVersionUID = 1L;/** * */JLabel lusername;JLabel lpassword;JTextField txtusername;JPasswordField txtpassword;JButton submit;JButton cancel;Panel pan;Container cont;Verify v;public Login(){

cont= getContentPane();cont.setLayout(new FlowLayout(FlowLayout.LEFT));pan=new Panel();pan.setLayout(new GridLayout(3,2));lusername=new JLabel("Enter the UserName");lpassword=new JLabel("Enter the Password");txtusername=new JTextField(15);txtpassword = new JPasswordField(15);submit=new JButton("Submit");cancel=new JButton("Exit");pan.add(lusername);pan.add(txtusername);pan.add(lpassword);pan.add(txtpassword);pan.add(submit);pan.add(cancel);cont.add(pan);submit.addActionListener(this);cancel.addActionListener(this);

v=new Verify();setSize(360,125);setVisible(true);

}public static void main(String args[]){

new Login();}

public void actionPerformed(ActionEvent arg0) {// TODO Auto-generated method stubif(arg0.getSource().equals(cancel)){

System.exit(0);}else if(arg0.getSource().equals(submit)){

//pass the username and password to verify objectif(check()){

v.sendRequest(txtusername.getText().trim()+"," + txtpassword.getText().trim());

this.setVisible(false);}

}}private boolean check(){

if(txtusername.getText().trim().equals("")){JOptionPane.showMessageDialog(null,"Enter the UserName");return false;

}else if(txtpassword.getText().trim().equals("")){

JOptionPane.showMessageDialog(null,"Enter the Password");return false;

}else

return true;}

}

5.6 SAMPLE INPUT AND OUTPUT:

CLIENT GETTING THE FILE

BLURRED IMAGE

DECRYPTED IMAGE

TESTING

AND

IMPLEMENTATION

6 .TESTING AND IMPLEMENTATION

6.1 TESTING:

Testing is a process of executing a program with a intent of finding an

error.

Testing presents an interesting anomaly for the software engineering.

The goal of the software testing is to convince system developer and

customers that the software is good enough for operational use. Testing is a

process intended to build confidence in the software.

Testing is a set of activities that can be planned in advance and conducted

systematically.

Testing is a set of activities that can be planned in advance and conducted

systematically.

Software testing is often referred to as verification & validation.

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

WHITE BOX TESTING:

It is also called as glass-box testing. It is a test case design method

that uses the control structure of the procedural design to derive test

cases.

Using white box testing methods, the software engineer can derive

test cases that

1. Guarantee that all independent parts within a module have

been exercised at least once,

2. Exercise all logical decisions on their true and false sides.

BLACK BOX TESTING:

Its also called as behavioral testing . It focuses on the

functional requirements of the software.

It is complementary approach that is likely to uncover a .

different class of errors than white box errors.

A black box testing enables a software engineering to derive a

sets of input conditions that will fully exercise all functional

requirements for a program.

ALPHA TESTING:

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:

The beta test is a “ live “ application of the software in an environment

that cannot be controlled by the developer. The beta test is conducted at one or

more customer sites by the end user of the software.

WIN RUNNER & LOAD RUNNER:

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. 

LOAD RUNNER TESTING:

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 : Testing of the debugging programs is one of the most critical

aspects of the computer programming triggers, without programs that works, the

system would never produce the output for which it was designed. Testing is best

performed when user development are asked to assist in identifying all errors and

bugs. The sample data are used for testing . It is not quantity but quality of the data

used the matters of testing. Testing is aimed at ensuring that the system was

accurately an efficiently before live operation commands.

6.1.3 UNIT TESTING:

In this testing we test each module individually and integrate with

the overall system. Unit testing focuses verification efforts on the smallest unit of

software design in the module. This is also known as module testing. The module

of the system is tested separately . This testing is carried out during programming

stage itself . In this testing step each module is found to working satisfactorily as

regard to the expected output from the module. There are some validation checks

for fields also. It is very easy to find error debut in the system.

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

MODULE 2: (CLIENT - SERVER ARCHITECTURE)

Primary goal:

Splitting of audio and video files .

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.

MODULE 3: (SPLITTING INTO AUDIO AND VIDEO)

Primary goal:

The audio file is captured and it is encrypted using AES.

Input:

Automated input.

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.

MODULE 4: (SPLITTING VIDEO INTO FRAMES)

Primary goal:

The video files are splitted into frames and each frame is encrypted using

AES

Input:

Automated input.

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.

MODULE 5: (AES PROCESS)

Primary goal:

AES must generate the s-box, sub bytes, shift rows , mix columns and

add round key.

Input:

Automated input

Process:

AES defines a 4*4 matrix of byte value that contains 8 bit values. Each

individual input byte is copied into a new byte.

Output:

Finally, we get the plain text. In this way AES process is done.

6.1.4 VALIDATION TESTING:

At the culmination of the black box testing, software is

completely assembled as a package, interfacing error have been uncovered and

corrected and a final series of software tests. That is, validation tests begin,

validation testing can be defined many ways but a simple definition is that

validation succeeds when the software functions in manner that can be reasonably

expected be the customer. After validation tests has been conducted one of the two

possible conditions exists.

TEST CASE NO EXPECTED OUTPUT

OBTAINED OUTPUT

REMARKS

1. Displays File Size , Number Of Frames ,Transmission Time And Frame latencyBased on input

Displays File Size, Transmission Time but not reception time and frame latency.

Error occurs in transmission of files.

data given.

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.

Advances in compression and an increase in affordable bandwidth will allow for

the streaming of higher resolution video and crisper audio.Developing better

speech to text software and more adaptive technologies in streaming will offer

greater accessibility.

CONCLUSION

8.CONCLUSION:

The secure media for adaptive streaming was successfully

completed and tested. The system has been designed keeping user interactivity as

the major commitment , implementing the project in Java platform with other

software’s , both code and the user control is maintained. This will surely satisfy

the users who are viewing the project.

The system is user friendly rather than the expert friendly. By

developing this project we have gained a lot of experience in creating in securing

media in a well known manner.

This project provides a quality of service in streaming media,

which gives the solution for streaming media faced problems. Securing and

authenticating the media files use the stream cipher and AES standard specify

RTP. Using this media file can be transferred with secure with less packet loss

REFERENCE

9. REFERENCE:

BOOKS:

1. Chitra Venkatramani , Peter Westerink, “Securing Media for Adaptive Streaming”, ACM 2003

2. Rogaway P. and Coppersmith D.A Software-Optimized Encryption Algorithm. Journal of Cryptology, 11(4):273-287, 1998.

3. L. Mengual, J. Bobadilla, R.Caballero , G.Hernandez,”Design and Testing of two secure Video Conferencing applications based on JMF(Java Media Framework) and VIC (Video Conferencing Tool ) “,IEEE 2006

4. Advanced Encryption Standard (AES), NIST FIPS 197

WEBSITE:

http://csrc.nist.gov/encryption/aes/index.html