digital image doc

Upload: suresh-poosapati

Post on 07-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Digital Image Doc

    1/95

    Digital Steganography using stochastic modulation

    ABSTRACT

    In this paper, we present a new steganographic paradigm for digital

    images in raster formats. Message bits are embedded in the cover image by

    adding a weak noise signal with a specified but arbitrary probabilistic

    distribution. This embedding mechanism provides the user with the

    flexibility to mask the embedding distortion as noise generated by a

    particular image acquisition device. This type of embedding will lead to

    more secure schemes because now the attacker must distinguish statistical

    anomalies that might be created by the embedding process from those

    introduced during the image acquisition itself. Unlike previously proposed

    schemes, this new approach, that we call stochastic modulation, achieves

    oblivious data transfer without using noise extraction algorithms or error

    correction. This leads to higher capacity (up to 0.8 bits per pixel) and a

    convenient and simple implementation with low embedding and extraction

    complexity. But most importantly, because the embedding noise can have

    arbitrary properties that approximate a given device noise, the new method

    offers better security than existing methods. At the end of this paper, we

    extend stochastic modulation to a content-dependent device noise and we

    also discuss possible attacks on this scheme based on the most recent

    advances in steganalysis.

  • 8/6/2019 Digital Image Doc

    2/95

    1.2. ORGANIZATION PROFILE

    SOFTWARE SOLUTIONS

    EdwareUK Ltd is an IT solution provider for a dynamic environment

    where business and technology strategies converge. Their approach focuses

    on new ways of business combining IT innovation and adoption while also

    leveraging an organizations current IT assets. Their work with large global

    corporations and new products or services and to implement prudent

    business and technology strategies in todays environment.

    EdwareUK LTD S RANGE OF EXPERTISE INCLUDES:

    Software Development Services

    Engineering Services

    Systems Integration

    Customer Relationship Management

    Product Development

    Electronic Commerce

  • 8/6/2019 Digital Image Doc

    3/95

    Consulting

    IT Outsourcing

    We apply technology with innovation and responsibility to achieve two

    broad objectives:

    Effectively address the business issues our customers face today.

    Generate new opportunities that will help them stay ahead in the

    future.

    THIS APPROACH RESTS ON:

    A strategy where we architect, integrate and manage technology

    services and solutions - we call it AIM for success.

    A robust offshore development methodology and reduced demand on

    customer resources.

    A focus on the use of reusable frameworks to provide cost and times

    benefits.

    They combine the best people, processes and technology to achieve

    excellent results - consistency. We offer customers the advantages of:

    SPEED:

    They understand the importance of timing, of getting there before thecompetition. A rich portfolio of reusable, modular frameworks helps jump-

    start projects. Tried and tested methodology ensures that we follow a

    predictable, low - risk path to achieve results. Our track record is testimony

    to complex projects delivered within and evens before schedule.

  • 8/6/2019 Digital Image Doc

    4/95

    EXPERTISE:

    Our teams combine cutting edge technology skills with rich domain

    expertise. Whats equally important - they share a strong customer

    orientation that means they actually start by listening to the customer.

    Theyre focused on coming up with solutions that serve customer

    requirements today and anticipate future needs.

    A FULL SERVICE PORTFOLIO:

    They offer customers the advantage of being able to Architect,

    integrate and manage technology services. This means that they can rely on

    one, fully accountable source instead of trying to integrate disparate multi

    vendor solutions.

    SERVICES:

    EdwareUK LTD is providing its services to companies which are in

    the field of production, quality control etc With their rich expertise and

    experience and information technology they are in best position to provide

    software solutions to distinct business requirements.

  • 8/6/2019 Digital Image Doc

    5/95

    INTRODUCTION

    PURPOSE OF THE SYSTEM

    The purpose of the system is to hide the very presence of communication

    by embedding messages into innocuous looking covering objects such as

    digital images.

    SCOPE OF THE SYSTEM

    In this system we present a new steganographic paradigm for digital

    images in raster formats.

    ABOUT THE PROJECT

    The purpose of steganography is to hide the very presence of communication

    by embedding messages into innocuous-looking cover objects, such as

    digital images. To accommodate a secret message, the original cover image

    is slightly modified by the embedding algorithm to obtain the stego image.The embedding process usually incorporates a secret stego-key that governs

    the embedding process and it is also needed for the extraction of the hidden

    message.

  • 8/6/2019 Digital Image Doc

    6/95

    In contrast to watermarking when the embedded message has a close

    relationship to the cover image supplying data, such as sender or receiver

    information, authentications codes, etc., in steganography, the cover image

    is a mere decoy and has no relationship to the hidden data. The most

    important requirement for a steganographic system is undetectability: stego

    images should be statistically indistinguishable from cover images. In other

    words, there should be no artifacts in the stego image that could be detected

    by an attacker with probability better than random guessing, given the full

    knowledge of the embedding algorithm except for the stego-key

    (Kerckhoffs principle).

    The early steganographic schemes focused on introducing as little distortion

    in the cover image as possible utilizing the seemingly intuitive heuristics

    that the smaller the embedding distortion is, the more secure the

    steganographic scheme becomes. However, recent advances in steganalysis

    clearly showed that this is not the case. The Least

    Significant Bit embedding (LSB) with sequential or random message spread

    has been successfully attacked even for very short messages. In essence, the

    LSB embedding is so easily detectable because it introduces distortion that

    never naturally occurs to images and creates an imbalance between

    appropriately defined statistical quantities. A better approach is to replace

    the operation of flipping the LSBs by randomly adding 1 or 1 to pixels (+

    1 embedding) and extracting the message bits from LSBs as in the classical

    LSB embedding. This is the embedding algorithm of Hide8 and it has also

    been accepted (in a slightly different version) for steganography in the JPEG

  • 8/6/2019 Digital Image Doc

    7/95

    format10. It turns out that this simple modification of the LSB embedding

    paradigm is, in fact, much more difficult to detect.

  • 8/6/2019 Digital Image Doc

    8/95

    1.3 SYSTEM SPECIFICATIONS

    HARDWARE SPECIFICATION

    The hardware used for the development of the project is:

    Processor : Pentium Dual core

    Ram : 1 GB

    Monitor : 15 Color

    Hard Disk : 80 GB

    SOFTWARE REQUIREMENTS

    The software used for the development of the project is:

    Language : Java (JDK1.5.0_06)

    Operating system : Windows family

    Technology : Java Swing

    Backend : MS-Access

  • 8/6/2019 Digital Image Doc

    9/95

    PROBLEMANALYSIS

    EXISTING SYSTEM

    In the current software to design steganographic schemes that embed

    messages by adding Gaussian noise to the image. Marvel et describe a high-

    capacity method for embedding message bits in uncompressed raw image

    formats. A special non-linear transformation together with the message bits

    is used to generate a Gaussian signal that is added to the cover image. The

    purpose of the transformation is to maximize the separation between two

    samples of a random Gaussian variable that encode a 0 and a 1. The message

    detector first applies an adaptive Wiener filter to the image to estimate the

    noise component. The noise component then determines the embedded bit

    via the inverse embedding function. The amplitude of the added Gaussian

    signal, however, must be large enough to minimize the errors during bit

    extraction. This forces the user to increase the amplitude of the added noise,

    which in turn decreases the security of the steganographic method. Error

    correction is also a necessity to guarantee error-free bit extraction even when

    no distortion is present. This further decreases the capacity of the method.We acknowledge that this work was focused on the capacity-robustness

    issue rather than

    security.

  • 8/6/2019 Digital Image Doc

    10/95

    PROPOSED SYSTEM

    In this software we describe a steganographic technique that

    embeds high payloads (up to 0.8 bpp for grayscale images) by adding a

    small-amplitude noise of specified properties to the image pixels. Because

    the probability distribution of the noise can be arbitrary, the communicating

    parties have the flexibility to mask the embedding distortion as superposition

    of a particular device noise. Thus, this embedding paradigm will provide

    better security than embedding that uses somewhat arbitrary operations, such

    as flipping the LSBs or adding a fixed-amplitude noise to the image (+1

    embedding).

    MODULES

    1. Authentication.

    2. Embed Encrypted data with image.

    3. Decompress image.

  • 8/6/2019 Digital Image Doc

    11/95

    Module Description:

    Authentication :

    In authentication module user should enter username and

    password. This information is sent to database table to verify whether valid

    user or not, Only the valid user can access the resource.

    Embed Encrypted Data with Image:

    Steganography is the science of hiding information. Whereas the goal of

    cryptography is to make data unreadable by a third party, the goal of

    steganography is to hide the data from a third party. In this article, I will

    discuss what steganography is, what purposes it serves. Before discussing

    how information is hidden in an image file, it is worth a fast review of how

    images are stored in the first place. An image file is merely a binary file

    containing a binary representation of the color or light intensity of each

    picture element (pixel) comprising the image.

    In this we are encoding the data with digital image ,for that user

    has to select the image file and enter data in text area. The data will be

    automatically embed with the image ,and user has to generate a secret key

    for security purpose. Then save the file in desired location.

  • 8/6/2019 Digital Image Doc

    12/95

    Decompression of Image:

    In this module select the image file loation to decrypt the image

    file.Enter the secret key to decompress the image file,if the key is not

    matched user cant access the encryption message. The key should be

    matched to get the encrypted message.once the key matched user will get

    encrypted data in the text Area.

  • 8/6/2019 Digital Image Doc

    13/95

    SYSTEM ANALYSIS

    FEASIBILITY SYSTEM

    Depending on the results of the initial investigation the survey is now

    expended to a more detailed feasibility study. FEASIBILTY STUDY is a

    test of system proposal according to its workability, impact of the

    organization, ability to meet needs and effective use of the resources.

    Steps in feasibility analysis:

    Eight steps involved in the feasibility analysis are:

    Form a project team and appoint a project leader.

    Enumerate potential proposed system.

    Define and identify characteristics of proposed

    system.

    Determine and evaluate performance and cost

    effective of each proposed system.

    Weight system performance and cost data.

    Select the best proposed system.

    Prepare and report final project directive to

    management.

  • 8/6/2019 Digital Image Doc

    14/95

    Three key considerations involved in the feasibility analysis are

    ECONOMICAL FEASIBILITY

    TECHNICAL FEASIBILITY

    SOCIAL FEASIBILITY

    ECONOMICAL FEASIBILITY

    This study is carried out to check the economic impact that the system

    will have on the organization. The amount of fund that the company can

    pour into the research and development of the system is limited. The

    expenditures must be justified. Thus the developed system as well within the

    budget and this was achieved because most of the technologies used are

    freely available. Only the customized products had to be purchased.

    TECHNICAL FEASIBILITY

    This study is carried out to check the technical feasibility, that is, the

    technical requirements of the system. Any system developed must not have a

    high demand on the available technical resources. This will lead to high

    demands on the available technical resources. This will lead to high

    demands being placed on the client. The developed system must have a

    modest requirement, as only minimal or null changes are required for

    implementing this system.

  • 8/6/2019 Digital Image Doc

    15/95

    SOCIAL FEASIBILITY

    The aspect of study is to check the level of acceptance of the system

    by the user. This includes the process of training the user to use the system

    efficiently. The user must not feel threatened by the system, instead must

    accept it as a necessity. The level of acceptance by the users solely depends

    on the methods that are employed to educate the user about the system and

    to make him familiar with it. His level of confidence must be raised so that

    he is also able to make some constructive criticism, which is welcomed, as

    he is the final user of the system.

  • 8/6/2019 Digital Image Doc

    16/95

    3. SOFTWARE PROFILE

    Java Technology

    Java technology is both a programming language and a platform.

    The Java Programming Language

    The Java programming language is a high-level language that can be

    characterized by all of the following buzzwords:

    Simple

    Architecture neutral

    Object oriented

    Portable

    Distributed

    High performance

    Interpreted

    Multithreaded

    Robust

    Dynamic

    Secure

    With most programming languages, you either compile or interpret a

    program so that you can run it on your computer. The Java programming

    language is unusual in that a program is both compiled and interpreted. With

    the compiler, first you translate a program into an intermediate language

    calledJava byte codes the platform-independent codes interpreted by the

    interpreter on the Java platform. The interpreter parses and runs each Java

    byte code instruction on the computer. Compilation happens just once;

  • 8/6/2019 Digital Image Doc

    17/95

    interpretation occurs each time the program is executed. The following

    figure illustrates how this works.

    FIGURE 2- WORKING OF JAVA

    You can think of Java bytecodes as the machine code instructions for

    theJava Virtual Machine (Java VM). Every Java interpreter, whether its a

    development tool or a Web browser that can run applets, is an

    implementation of the Java VM. Java bytecodes help make write once, run

    anywhere possible. You can compile your program into bytecodes on any

    platform that has a Java compiler. The bytecodes can then be run on any

    implementation of the Java VM. That means that as long as a computer has a

    Java VM, the same program written in the Java programming language can

    run on Windows 2000, a Solaris workstation, or on an iMac.

    The Java Platform

    A platform is the hardware or software environment in which a

    program runs. Weve already mentioned some of the most popular platforms

    like Windows 2000, Linux, Solaris, and MacOS. Most platforms can be

    described as a combination of the operating system and hardware. The Java

    platform differs from most other platforms in that its a software-only

    platform that runs on top of other hardware-based platforms.

    The Java platform has two components:

  • 8/6/2019 Digital Image Doc

    18/95

    TheJava Virtual Machine (Java VM)

    TheJava Application Programming Interface (Java API)

    Youve already been introduced to the Java VM. Its the base for the

    Java platform and is ported onto various hardware-based platforms.

    The Java API is a large collection of ready-made software components that

    provide many useful capabilities, such as graphical user interface (GUI)

    widgets. The Java API is grouped into libraries of related classes and

    interfaces; these libraries are known as packages. The next section, What

    Can Java Technology Do?, highlights what functionality some of the

    packages in the Java API provide.

    The following figure depicts a program thats running on the Java

    platform. As the figure shows, the Java API and the virtual machine insulate

    the program from the hardware.

    FIGURE 3- THE JAVA PLATFORM

    Native code is code that after you compile it, the compiled code runs

    on a specific hardware platform. As a platform-independent environment,

    the Java platform can be a bit slower than native code. However, smart

    compilers, well-tuned interpreters, and just-in-time bytecode compilers can

    bring performance close to that of native code without threatening

    portability.

  • 8/6/2019 Digital Image Doc

    19/95

    What Can Java Technology Do?

    The most common types of programs written in the Java programming

    language are applets and applications. If youve surfed the Web, youre

    probably already familiar with applets. An applet is a program that adheres

    to certain conventions that allow it to run within a Java-enabled browser.

    However, the Java programming language is not just for writing cute,

    entertaining applets for the Web. The general-purpose, high-level Java

    programming language is also a powerful software platform. Using the

    generous API, you can write many types of programs.

    An application is a standalone program that runs directly on the Java

    platform. A special kind of application known as a server serves and

    supports clients on a network. Examples of servers are Web servers, proxy

    servers, mail servers, and print servers. Another specialized program is a

    servlet. A servlet can almost be thought of as an applet that runs on the

    server side. Java Servlets are a popular choice for building interactive web

    applications, replacing the use of CGI scripts. Servlets are similar to applets

    in that they are runtime extensions of applications. Instead of working in

    browsers, though, servlets run within Java Web servers, configuring or

    tailoring the server.

    How does the API support all these kinds of programs? It does so with

    packages of software components that provide a wide range of functionality.

    Every full implementation of the Java platform gives you the following

    features:

    The essentials: Objects, strings, threads, numbers, input and output,

    data structures, system properties, date and time, and so on.

    Applets: The set of conventions used by applets.

  • 8/6/2019 Digital Image Doc

    20/95

    Networking: URLs, TCP (Transmission Control Protocol), UDP

    (User Data gram Protocol) sockets, and IP (Internet Protocol)

    addresses.

    Internationalization: Help for writing programs that can be localized

    for users worldwide. Programs can automatically adapt to specific

    locales and be displayed in the appropriate language.

    Security: Both low level and high level, including electronic

    signatures, public and private key management, access control, and

    certificates.

    Software components: Known as JavaBeansTM, can plug into existing

    component architectures.

    Object serialization: Allows lightweight persistence and

    communication via Remote Method Invocation (RMI).

    Java Database Connectivity (JDBCTM): Provides uniform access to

    a wide range of relational databases.

    The Java platform also has APIs for 2D and 3D graphics, accessibility,

    servers, collaboration, telephony, speech, animation, and more. The

    following figure depicts what is included in the Java 2 SDK.

  • 8/6/2019 Digital Image Doc

    21/95

    FIGURE 4 JAVA 2 SDK

    Swings

    The Swing toolkit includes a rich set of components for building GUIs and

    adding interactivity to Java applications. Swing includes all the components

    you would expect from a modern toolkit: table controls, list controls, tree

    controls, buttons, and labels. Swing is far from a simple component toolkit,

    however. It includes rich undo support, a highly customizable text package,

    integrated internationalization and accessibility support. To truly leverage

    the cross-platform capabilities of the Java platform, Swing supports

    numerous look and feels, including the ability to create your own look and

    feel. The ability to create a custom look and feel is made easier with Synth, a

    look and feel specifically designed to be customized. Swing wouldn't be a

    component toolkit without the basic user interface primitives such as drag

    and drop, event handling, customizable painting, and window management.

    Swing is part of the Java Foundation Classes (JFC). The JFC also include

    other features important to a GUI program, such as the ability to add rich

    graphics functionality and the ability to create a program that can work in

    different languages and by users with different input devices.

  • 8/6/2019 Digital Image Doc

    22/95

    Networking

    TCP/IP stack

    The TCP/IP stack is shorter than the OSI one:

    FIGURE 5 TCP/IP STACK

    TCP is a connection-oriented protocol; UDP (User Datagram Protocol) is a

    connectionless protocol.

    IP datagrams

    The IP layer provides a connectionless and unreliable delivery system.

    It considers each datagram independently of the others. Any association

    between datagram must be supplied by the higher layers. The IP layer

    supplies a checksum that includes its own header. The header includes the

    source and destination addresses. The IP layer handles routing through an

  • 8/6/2019 Digital Image Doc

    23/95

    Internet. It is also responsible for breaking up large datagram into smaller

    ones for transmission and reassembling them at the other end.

    TCP

    TCP supplies logic to give a reliable connection-oriented protocol

    above IP. It provides a virtual circuit that two processes can use to

    communicate.

    Internet addresses

    In order to use a service, you must be able to find it. The Internet uses

    an address scheme for machines so that they can be located. The address is a

    32 bit integer which gives the IP address. This encodes a network ID and

    more addressing. The network ID falls into various classes according to the

    size of the network address.

    Network address

    Class A uses 8 bits for the network address with 24 bits left over for

    other addressing. Class B uses 16 bit network addressing. Class C uses 24

    bit network addressing and class D uses all 32.

    Subnet address

    Internally, the UNIX network is divided into sub networks. Building

    11 is currently on one sub network and uses 10-bit addressing, allowing

    1024 different hosts.

  • 8/6/2019 Digital Image Doc

    24/95

    Host address

    8 bits are finally used for host addresses within our subnet. This

    places a limit of 256 machines that can be on the subnet.

    Total address

    FIGURE 6 - IP ADDRESSING

    The 32 bit address is usually written as 4 integers separated by dots.

    Port addresses

    A service exists on a host, and is identified by its port. This is a 16 bit

    number. To send a message to a server, you send it to the port for that

    service of the host that it is running on. This is not location transparency!

    Certain of these ports are "well known".

    Sockets

    A socket is a data structure maintained by the system to handle

    network connections. A socket is created using the call socket. It returns

    an integer that is like a file descriptor. In fact, under Windows, this handle

    can be used with Read File and Write File functions.

  • 8/6/2019 Digital Image Doc

    25/95

    #include

    #include

    int socket(int family, int type, int protocol);

    Here "family" will be AF_INET for IP communications, protocol will be

    zero, and type will depend on whether TCP or UDP is used. Two processes

    wishing to communicate over a network create a socket each. These are

    similar to two ends of a pipe - but the actual pipe does not yet exist.

    Servlets:

    Servlets are server side components that provide a powerful mechanism for

    developing server side programs. Servlets provide component based,

    platform-independent methods for building Web-based applications, without

    the performance limitations of CGI programs. Unlike proprietary server

    extension mechanisms (such as the Netscape Server API or Apache

    modules), servlets are server as well as platform-independent. This leaves

    you free to select a "best of breed" strategy for your servers, platforms, and

    tools. Using servlets web developers can create fast and efficient server side

    application which can run on any servlet enabled web server. Servlets run

    entirely inside the Java Virtual Machine. Since the Servlet runs at server side

    so it does not checks the browser for compatibility. Servlets can access the

    entire family of Java APIs, including the JDBC API to access enterprise

    databases. Servlets can also access a library of HTTP-specific calls, receive

    all the benefits of the mature java language including portability,

    performance, reusability, and crash protection. Today servlets are the

    popular choice for building interactive web applications. Third-party servlet

    containers are available for Apache Web Server, Microsoft IIS, and others.

  • 8/6/2019 Digital Image Doc

    26/95

    Servlet containers are usually the components of web and application

    servers, such as BEA WebLogic Application Server, IBM WebSphere, Sun

    Java System Web Server, Sun Java System Application Server and others.

    Servlets are not designed for a specific protocols. It is different thing that

    they are most commonly used with the HTTP protocols Servlets uses the

    classes in the java packages javax.servlet and javax.servlet.http. Servlets

    provides a way of creating the sophisticated server side extensions in a

    server as they follow the standard framework and use the highly portable

    java language.

    HTTP Servlet typically used to:

    Priovide dynamic content like getting the results of a database query and

    returning to the client.

    Process and/or store the data submitted by the HTML.

    Manage information about the state of a stateless HTTP. e.g. an online

    shopping car manages request for multiple concurrent customers.

    ODBC

    Microsoft Open Database Connectivity (ODBC) is a standard

    programming interface for application developers and database systems

    providers. Before ODBC became a de facto standard for Windows programs

    to interface with database systems, programmers had to use proprietary

    languages for each database they wanted to connect to. Now, ODBC has

  • 8/6/2019 Digital Image Doc

    27/95

    made the choice of the database system almost irrelevant from a coding

    perspective, which is as it should be. Application developers have much

    more important things to worry about than the syntax that is needed to port

    their program from one database to another when business needs suddenly

    change.

    Through the ODBC Administrator in Control Panel, you can specify

    the particular database that is associated with a data source that an ODBC

    application program is written to use. Think of an ODBC data source as a

    door with a name on it. Each door will lead you to a particular database. For

    example, the data source named Sales Figures might be a SQL Server

    database, whereas the Accounts Payable data source could refer to an Access

    database. The physical database referred to by a data source can reside

    anywhere on the LAN.

    The ODBC system files are not installed on your system by Windows

    95. Rather, they are installed when you setup a separate database

    application, such as SQL Server Client or Visual Basic 4.0. When the

    ODBC icon is installed in Control Panel, it uses a file called

    ODBCINST.DLL. It is also possible to administer your ODBC data sources

    through a stand-alone program called ODBCADM.EXE. There is a 16-bit

    and a 32-bit version of this program, and each maintains a separate list of

    ODBC data sources.

    From a programming perspective, the beauty of ODBC is that the

    application can be written to use the same set of function calls to interface

    with any data source, regardless of the database vendor. The source code of

    the application doesnt change whether it talks to Oracle or SQL Server. We

    only mention these two as an example. There are ODBC drivers available

  • 8/6/2019 Digital Image Doc

    28/95

    for several dozen popular database systems. Even Excel spreadsheets and

    plain text files can be turned into data sources. The operating system uses

    the Registry information written by ODBC Administrator to determine

    which low-level ODBC drivers are needed to talk to the data source (such as

    the interface to Oracle or SQL Server). The loading of the ODBC drivers is

    transparent to the ODBC application program. In a client/server

    environment, the ODBC API even handles many of the network issues for

    the application programmer.

    The advantages of this scheme are so numerous that you are probably

    thinking there must be some catch. The only disadvantage of ODBC is that it

    isnt as efficient as talking directly to the native database interface. ODBC

    has had many detractors make the charge that it is too slow. Microsoft has

    always claimed that the critical factor in performance is the quality of the

    driver software that is used. In our humble opinion, this is true. The

    availability of good ODBC drivers has improved a great deal recently. And

    anyway, the criticism about performance is somewhat analogous to those

    who said that compilers would never match the speed of pure assembly

    language. Maybe not, but the compiler (or ODBC) gives you the opportunity

    to write cleaner programs, which means you finish sooner. Meanwhile,

    computers get faster every year.

    JDBC

    In an effort to set an independent database standard API for Java, Sun

    Microsystems developed Java Database Connectivity, or JDBC. JDBC

    offers a generic SQL database access mechanism that provides a consistent

    interface to a variety of RDBMSs. This consistent interface is achieved

    through the use of plug-in database connectivity modules, ordrivers. If a

  • 8/6/2019 Digital Image Doc

    29/95

    database vendor wishes to have JDBC support, he or she must provide the

    driver for each platform that the database and Java run on.

    To gain a wider acceptance of JDBC, Sun based JDBCs framework

    on ODBC. As you discovered earlier in this chapter, ODBC has widespread

    support on a variety of platforms. Basing JDBC on ODBC will allow

    vendors to bring JDBC drivers to market much faster than developing a

    completely new connectivity solution.

    JDBC was announced in March of 1996. It was released for a 90 day public

    review that ended June 8, 1996. Because of user input, the final JDBC v1.0

    specification was released soon after.

    The remainder of this section will cover enough information about

    JDBC for you to know what it is about and how to use it effectively. This is

    by no means a complete overview of JDBC. That would fill an entire book.

    JDBC Goals

    Few software packages are designed without goals in mind. JDBC is

    one that, because of its many goals, drove the development of the API.

    These goals, in conjunction with early reviewer feedback, have finalized the

    JDBC class library into a solid framework for building database applications

    in Java.

    The goals that were set for JDBC are important. They will give you

    some insight as to why certain classes and functionalities behave the way

    they do. The eight design goals for JDBC are as follows:

    1. SQL Level API

    The designers felt that their main goal was to define a SQL interface for

    Java. Although not the lowest database interface level possible, it is at a low

  • 8/6/2019 Digital Image Doc

    30/95

    enough level for higher-level tools and APIs to be created. Conversely, it is

    at a high enough level for application programmers to use it confidently.

    Attaining this goal allows for future tool vendors to generate JDBC code

    and to hide many of JDBCs complexities from the end user.

    2. SQL Conformance

    SQL syntax varies as you move from database vendor to database vendor. In

    an effort to support a wide variety of vendors, JDBC will allow any query

    statement to be passed through it to the underlying database driver. This

    allows the connectivity module to handle non-standard functionality in a

    manner that is suitable for its users.

    3. JDBC must be implemental on top of common database interfaces

    The JDBC SQL API must sit on top of other common SQL level

    APIs. This goal allows JDBC to use existing ODBC level drivers by

    the use of a software interface. This interface would translate JDBC

    calls to ODBC and vice versa.

    4. Provide a Java interface that is consistent with the rest of the Java

    system

    Because of Javas acceptance in the user community thus far, the designers

    feel that they should not stray from the current design of the core Java

    system.

    5. Keep it simple

    This goal probably appears in all software design goal listings. JDBC is no

    exception. Sun felt that the design of JDBC should be very simple, allowing

    for only one method of completing a task per mechanism. Allowing

    duplicate functionality only serves to confuse the users of the API.

  • 8/6/2019 Digital Image Doc

    31/95

    6. Use strong, static typing wherever possible

    Strong typing allows for more error checking to be done at compile time;

    also, less error appear at runtime.

    7. Keep the common cases simple

    Because more often than not, the usual SQL calls used by the

    programmer are simple SELECTs, INSERTs, DELETEs and UPDATEs,

    these queries should be simple to perform with JDBC. However, more

    complex SQL statements should also be possible.

    TABLE DESIGN

    Tables are logical structures maintained by the database

    manager. Tables are made up of columns and rows.

    At the intersection of every column and row is a specific data

    item called a value. A column is a set of values of the same type

    or one of its subtypes. A row is a sequence of values arranged

    so that the nth value is a value of the nth column of the table.

    An application program can determine the order in which the

    rows are populated into the table, but the actual order of rows is

    determined by the database manager, and typically cannot be

  • 8/6/2019 Digital Image Doc

    32/95

    controlled. Multidimensional clustering (MDC) provides some

    sense of clustering, but not actual ordering between the rows.

    When designing tables, you need to be familiar with certain

    concepts, determine the space requirements for tables and user

    data, and determine whether you will take advantage of certain

    features, such as space compression and optimistic locking.

    When designing partitioned tables, you need to be familiar with the

    partitioning concepts, such as:

    Data organization schemes

    Table partitioning keys

    Keys used for distributing data across data partitions

    Keys used for MDC dimensions

  • 8/6/2019 Digital Image Doc

    33/95

    4. SYSTEM DESIGN

    Use case diagram:

    A use case diagram in the Unified Modeling Language (UML) is a

    type of behavioral diagram defined by and created from a Use-case

    analysis. Its purpose is to present a graphical overview of the

    functionality provided by a system in terms of actors, their goals

    (represented as use cases), and any dependencies between those use

    cases.

  • 8/6/2019 Digital Image Doc

    34/95

    The main purpose of a use case diagram is to show what system

    functions are performed for which actor. Roles of the actors in the

    system can be depicted.

  • 8/6/2019 Digital Image Doc

    35/95

  • 8/6/2019 Digital Image Doc

    36/95

    Class Diagram:

    Class diagrams are the mainstay of object-oriented analysis and

    design. Class diagrams show the classes of the system, their

    interrelationships (including inheritance, aggregation, and association), and

    the operations and attributes of the classes. Class diagrams are used for a

    wide variety of purposes, including both conceptual/domain modeling and

    detailed design modeling.

  • 8/6/2019 Digital Image Doc

    37/95

  • 8/6/2019 Digital Image Doc

    38/95

    Sequence Diagram:

    A sequence diagram in Unified Modeling Language (UML) is a kind

    of interaction diagram that shows how processes operate with one

    another and in what order. It is a construct of a Message Sequence

    Chart.

    Sequence diagrams are sometimes called Event-trace diagrams, event

    scenarios, and timing diagrams.

    A sequence diagram shows, as parallel vertical lines (lifelines),

    different processes or objects that live simultaneously, and, as

    horizontal arrows, the messages exchanged between them, in the order

    in which they occur. This allows the specification of simple runtime

    scenarios in a graphical manner.

  • 8/6/2019 Digital Image Doc

    39/95

  • 8/6/2019 Digital Image Doc

    40/95

    Collaboration Diagram:

    Collaboration diagrams belong to a group of UML diagrams called

    Interaction Diagrams. Collaboration diagrams, like Sequence Diagrams,

    show how objects interact over the course of time. However, instead of

    showing the sequence of events by the layout on the diagram, collaboration

    diagrams show the sequence by numbering the messages on the diagram.

    This makes it easier to show how the objects are linked together, but harder

    to see the sequence at a glance.

  • 8/6/2019 Digital Image Doc

    41/95

    Activity Diagram:

    Activity diagrams are typically used for business process modeling, for

    modeling the logic captured by a single use case or usage scenario, or for

    modeling the detailed logic of a business rule. Although UML activity

    diagrams could potentially model the internal logic of a complex operation it

    would be far better to simply rewrite the operation so that it is simple

    enough that you dont require an activity diagram. In many ways UML

    activity diagrams are the object-oriented equivalent offlow charts and data

    flow diagrams (DFDs) from structured development.

    http://www.agilemodeling.com/artifacts/systemUseCase.htmhttp://www.agilemodeling.com/artifacts/businessRule.htmhttp://www.agilemodeling.com/artifacts/flowChart.htmhttp://www.agilemodeling.com/artifacts/dataFlowDiagram.htmhttp://www.agilemodeling.com/artifacts/dataFlowDiagram.htmhttp://www.agilemodeling.com/artifacts/systemUseCase.htmhttp://www.agilemodeling.com/artifacts/businessRule.htmhttp://www.agilemodeling.com/artifacts/flowChart.htmhttp://www.agilemodeling.com/artifacts/dataFlowDiagram.htmhttp://www.agilemodeling.com/artifacts/dataFlowDiagram.htm
  • 8/6/2019 Digital Image Doc

    42/95

  • 8/6/2019 Digital Image Doc

    43/95

    5. TESTING AND IMPLEMENTATION

    5.1 TESTING PROCESS

    The purpose of testing is to discover errors. Testing is the process of

    trying to discover every conceivable fault or weakness in a work product. It

    provides a way to check the functionality of components, sub assemblies,

    assemblies and/or a finished product It is the process of exercising software

    with the intent of ensuring that the Software system meets its requirements

    and user expectations and does not fail in an unacceptable manner. There are

    various types of test. Each test type addresses a specific testing requirement.

    TYPES OF TESTS

    UNIT TESTING

    Unit testing involves the design of test cases that validate that the

    internal program logic is functioning properly, and that program inputproduces valid outputs. All decision branches and internal code flow should

    be validated. It is the testing of individual software units of the application

    .it is done after the completion of an individual unit before integration. This

    is a structural testing, that relies on knowledge of its construction and is

    invasive. Unit tests perform basic tests at component level and test a specific

    business process, application, and/or system configuration. Unit tests ensure

    that each unique path of a business process performs accurately to the

    documented specifications and contains clearly defined inputs and expected

    results.

  • 8/6/2019 Digital Image Doc

    44/95

    INTEGRATION TESTING

    Integration tests are designed to test integrated software components

    to determine if they actually run as one program. Testing is event driven and

    is more concerned with the basic outcome of screens or fields. Integration

    tests demonstrate that although the components were individually

    satisfaction, as shown by successfully unit testing, the combination of

    components is correct and consistent. Integration testing is specifically

    aimed at exposing the problems that arise from the combination of

    components.

    FUNCTIONAL TESTING

    Functional tests provide systematic demonstrations that functions

    tested are available as specified by the business and technical requirements,

    system documentation and user manuals.

    Functional testing is centered on the following items:

    Valid Input : identified classes of valid input must be accepted.

    Invalid Input : identified classes of invalid input must be rejected.

    Functions : identified functions must be exercised.

    Output : identified classes of application outputs must be

    exercised

    Systems/Procedures : interfacing systems or procedures must be invoked.

    Organization and preparation of functional tests is focused on

    requirements, key functions, or special test cases. In addition, systematic

    coverage pertaining to identify Business process flows; data fields,

    predefined processes, and successive processes must be considered for

  • 8/6/2019 Digital Image Doc

    45/95

    testing. Before functional testing is complete, additional tests are identified

    and the effective value of current tests is determined.

    SYSTEM TESTING

    System testing ensures that the entire integrated software system meets

    requirements. It tests a configuration to ensure known and predictable

    results. An example of system testing is the configuration oriented system

    integration test. System testing is based on process descriptions and flows,

    emphasizing pre-driven process links and integration points.

    BOX TESTING

    White Box Testing is a testing in which the software tester has

    knowledge of the inner workings, structure and language of the software, or

    at least its purpose. It is used to test areas that cannot be reached from a

    black box level.

    BLACK BOX TESTING

    Black Box Testing is testing the software without any knowledge of

    the inner workings, structure or language of the module being tested. Black

    box tests, as most other kinds of tests, must be written from a definitive

    source document, such as specification or requirements document, such as

    specification or requirements document. It is a testing in which the software

    under test is treated, as a black box .you cannot see into it. The test

    provides inputs and responds to outputs without considering how the

    software works.

  • 8/6/2019 Digital Image Doc

    46/95

    UNIT TESTING

    Unit testing is usually conducted as part of a combined code and unit

    test phase of the software lifecycle, although it is not uncommon for coding

    and unit testing to be conducted as two distinct phases.

    TEST STRATEGY AND APPROACH

    Field testing will be performed manually and functional tests will be

    written in detail.

    Test objectives

    All field entries must work properly.

    Pages must be activated from the identified link.

    The entry screen, messages and responses must not be delayed.

    Features to be tested

    Verify that the entries are of the correct format

    No duplicate entries should be allowed

    All links should take the user to the correct page.

    Integration Testing

    Software integration testing is the incremental integration testing of

    two or more integrated software components on a single platform to produce

    failures caused by interface defects.

  • 8/6/2019 Digital Image Doc

    47/95

    The task of the integration test is to check that components or

    software applications, e.g. components in a software system or one step up

    software applications at the company level interact without error.

    Acceptance Testing

    User Acceptance Testing is a critical phase of any project and requires

    significant participation by the end user. It also ensures that the system

    meets the functional requirements.

    Test Results

    All the test cases mentioned above passed successfully. No defects

    encountered.

  • 8/6/2019 Digital Image Doc

    48/95

    IMPLEMENTATION AND MAINTANANCE

    Implementation is the stage of the project when the theoretical design

    is turned out into a working system. Thus it can be considered to be the most

    critical stage in achieving a successful new system and in giving the user,

    confidence that the new system will work and be effective.

    The implementation stage involves careful planning, investigation of

    the existing system and its constraints on implementation, designing of

    methods to achieve changeover and evaluation of changeover methods.

    Implementation is the process of converting a new system design into

    operation. It is the phase that focuses on user training, site preparation and

    file conversion for installing a candidate system. The important factor that

    should be considered here is that the conversion should not disrupt the

    functioning of the organization.

  • 8/6/2019 Digital Image Doc

    49/95

    6. CONCLUSION AND FUTURE SCOPE

    In this paper, we describe a steganographic technique that embeds high

    payloads (up to 0.8 bpp for grayscale images) by adding a small-amplitude

    noise of specified properties to the image pixels. Because the probability

    distribution of the noise can be arbitrary, the communicating parties have the

    flexibility to mask the embedding distortion as superposition of a particular

    device noise. Thus, this embedding paradigm will provide better security

    than embedding that uses somewhat arbitrary operations, such as flipping

    the LSBs or adding a fixed-amplitude noise to the image (+1 embedding).

    Compared to previously proposed methods that embed messages by adding

    Gaussian noise1,7, stochastic modulation can embed bigger payloads

    without using error correction schemes or denoising algorithms at the

    receiving end, which makes the algorithm significantly simpler and faster.

    Because the noise distribution can be arbitrarily adjusted, the new method

    provides much greater flexibility than previous methods.

    This paper also pays close attention to practical implementation issues, such

    as the issue of having to communicate the parameters of the added stego

    noise and the necessity to use different noise signals for each image due to

    security. In Section 6, we show that the concept of stochastic modulation can

    be extended to stego noise that depends on the image content.The security of

  • 8/6/2019 Digital Image Doc

    50/95

    data hiding by adding noise to the cover image has been recently

    addressed ,These attacks, however, do not work well for grayscale images

    and may produce a significant rate of false positives for color scans

    of natural photographs and resampled images.

    Future directions include steganalysis of the proposed steganographic

    paradigm. In particular, it appears that distinguishing stego images

    embedded using stochastic modulation from color scans or resampled

    images is of paramount importance. Analyzing the difference between these

    image classes appears to be the key part in building

    reliable detection algorithms.

  • 8/6/2019 Digital Image Doc

    51/95

    7. APPRNDICES

    7.1 SCREENS:

  • 8/6/2019 Digital Image Doc

    52/95

  • 8/6/2019 Digital Image Doc

    53/95

  • 8/6/2019 Digital Image Doc

    54/95

  • 8/6/2019 Digital Image Doc

    55/95

  • 8/6/2019 Digital Image Doc

    56/95

  • 8/6/2019 Digital Image Doc

    57/95

  • 8/6/2019 Digital Image Doc

    58/95

  • 8/6/2019 Digital Image Doc

    59/95

  • 8/6/2019 Digital Image Doc

    60/95

  • 8/6/2019 Digital Image Doc

    61/95

  • 8/6/2019 Digital Image Doc

    62/95

  • 8/6/2019 Digital Image Doc

    63/95

  • 8/6/2019 Digital Image Doc

    64/95

  • 8/6/2019 Digital Image Doc

    65/95

  • 8/6/2019 Digital Image Doc

    66/95

    7.2 SAMPLE CODING

    import java.awt.Component;import java.awt.Container;

    import java.awt.Dimension;

    import java.awt.Font;

    import java.awt.Insets;

    import java.awt.LayoutManager;

    import java.awt.event.ActionEvent;

    import java.awt.event.ActionListener;

    import java.awt.event.WindowAdapter;

    import java.awt.event.WindowEvent;

    import java.io.Serializable;

    import java.sql.Connection;import java.sql.DriverManager;

    import java.sql.ResultSet;

    import java.sql.Statement;

    import javax.swing.JButton;

    import javax.swing.JDialog;

    import javax.swing.JFrame;

    import javax.swing.JLabel;

    import javax.swing.JOptionPane;

    import javax.swing.JPasswordField;

    import javax.swing.JTextField;

    import javax.swing.UIManager;

    public class Login extends JFrame implements ActionListener,Serializable {

    JLabel label1;

    JLabel label2;

    JTextField textfield1;

    JPasswordField passwordfield2;

    JButton button1;

    JLabel label3;

    public Login() {

    LoginLayout customLayout = new LoginLayout();

    getContentPane().setFont(new Font("Tahoma", Font.PLAIN, 12));

    getContentPane().setLayout(customLayout);

  • 8/6/2019 Digital Image Doc

    67/95

    label1 = new JLabel("Login Name");

    getContentPane().add(label1);

    label1.setFont(new Font("Bookman Old Style",Font.BOLD,20));

    label2 = new JLabel("Password");

    getContentPane().add(label2);label2.setFont(new Font("Bookman Old Style",Font.BOLD,20));

    textfield1 = new JTextField();

    getContentPane().add(textfield1);

    textfield1.setFont(new Font("RockWell",Font.PLAIN,18));

    passwordfield2 = new JPasswordField();

    getContentPane().add(passwordfield2);

    passwordfield2.setEchoChar('*');

    passwordfield2.setFont(new Font("SansSerif",Font.BOLD,20));

    //ImageIcon icon1 = new ImageIcon("r1.jpg");

    button1 = new JButton("LOGIN");

    getContentPane().add(button1);

    button1.addActionListener(this);

    button1.setFont(new Font("Engravers MT",Font.BOLD,20));

    //ImageIcon icon = new ImageIcon("r1.jpg");

    //label3 = new JLabel("",icon,JLabel.LEFT);

    //getContentPane().add(label3);

    setSize(getPreferredSize());

    addWindowListener(new WindowAdapter() {

    public void windowClosing(WindowEvent e) {

    System.exit(0);

    }

    });

    }

    public static void main(String args[]) {

    Login window = new Login();

    window.setTitle("Stegnography Implementation");

    window.pack();

    window.show();

  • 8/6/2019 Digital Image Doc

    68/95

    JFrame.setDefaultLookAndFeelDecorated(true);

    JDialog.setDefaultLookAndFeelDecorated(true);

    try

    {

    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAnd

    Feel");

    //

    javax.swing.UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel

    ");

    }

    catch (Exception ex)

    { System.out.println("Failed loading L&F: ");

    System.out.println(ex);

    }

    }

    public void actionPerformed(ActionEvent e)

    {

    String cmd;

    cmd=e.getActionCommand();

    if(cmd.equals("LOGIN"))

    {

    String user=textfield1.getText().trim().toLowerCase();

    String password=passwordfield2.getText().trim().toLowerCase();

    try

    {

    System.out.println("test");

    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";

    String url = "jdbc:odbc:pavan";

    String DBusername ="admin";

    String DBpassword = "admin";

    Class.forName(driver);

    Connection connection =

    DriverManager.getConnection(url,DBusername,DBpassword);

    Statement statement = connection.createStatement();

    String query = "SELECT * FROM pavan WHERE LoginName='"+user+"'

    AND Password='"+password+"'";

    System.out.println(query);

  • 8/6/2019 Digital Image Doc

    69/95

    ResultSet rs = statement.executeQuery(query);

    boolean recordfound = rs.next();

    if (recordfound)

    {dispose();

    Stegno en = new Stegno();

    en.pack();

    en.show();

    en.setTitle("Steganography Implementation - Main Menu");

    }

    else

    {

    JOptionPane.showMessageDialog(null,"!!!

    ***Username and password do not

    match*** !!!","Error",JOptionPane.INFORMATION_MESSAGE);textfield1.setText("");

    passwordfield2.setText("");

    }

    rs.close();

    }

    catch(Exception sqle){

    sqle.printStackTrace();

    }

    }

    }

    class LoginLayout implements LayoutManager {

    public LoginLayout() {

    }

    public void addLayoutComponent(String name, Component comp) {

    }

    public void removeLayoutComponent(Component comp) {

    }

    public Dimension preferredLayoutSize(Container parent) {

    Dimension dim = new Dimension(0, 0);

    Insets insets = parent.getInsets();

    dim.width = 650 + insets.left + insets.right;

    dim.height = 400 + insets.top + insets.bottom;

  • 8/6/2019 Digital Image Doc

    70/95

    return dim;

    }

    public Dimension minimumLayoutSize(Container parent) {

    Dimension dim = new Dimension(0, 0);return dim;

    }

    public void layoutContainer(Container parent) {

    Insets insets = parent.getInsets();

    Component c;

    c = parent.getComponent(0);

    if (c.isVisible()) {c.setBounds(insets.left+150,insets.top+100,136,32);}

    c = parent.getComponent(1);

    if (c.isVisible()) {c.setBounds(insets.left+150,insets.top+150,136,32);}c = parent.getComponent(2);

    if (c.isVisible()) {c.setBounds(insets.left+280,insets.top+100,154,35);}

    c = parent.getComponent(3);

    if (c.isVisible()) {c.setBounds(insets.left+280,insets.top+150,154,35);}

    c = parent.getComponent(4);

    if (c.isVisible()) {c.setBounds(insets.left+276,insets.top+216,160,48);}

    //c = parent.getComponent(5);

    //if (c.isVisible()) {c.setBounds(insets.left+0,insets.top+0,700,600);}

    }

    }

    }

  • 8/6/2019 Digital Image Doc

    71/95

    import java.awt.*;

    import java.awt.event.*;

    import javax.swing.*;

    import java.util.*;import java.math.*;

    import javax.imageio.ImageIO;

    import java.io.File;

    import java.io.FileInputStream;

    import java.io.FileOutputStream;

    import java.io.IOException;

    import javax.swing.event.*;

    import javax.swing.filechooser.*;

    import java.beans.*;

    import java.awt.event.ActionListener;import java.sql.*;

    import java.lang.*;

    import java.awt.event.ActionEvent;

    import java.awt.font.*;

    import java.lang.String;

    import java.awt.Component;

    import java.awt.geom.*;

    import javax.swing.text.EditorKit;

    import javax.swing.event.MouseInputAdapter;

    import java.awt.image.BufferedImage;

    import javax.swing.text.*;

    import javax.crypto.Cipher;

    import java.security.*;

    import java.lang.Exception;

    import java.io.DataOutputStream;

    import java.io.DataInputStream;

    import java.io.Serializable;

    import java.io.UnsupportedEncodingException;

    import java.security.InvalidKeyException;

    import java.security.NoSuchAlgorithmException;

    import java.util.Random;

    //import javax.crypto.BadPaddingException;

    //import javax.crypto.IllegalBlockSizeException;

    //import javax.crypto.NoSuchPaddingException;

    import java.io.FilterInputStream;

    import javax.crypto.*;

    //import java.security.AlgorithmParameters;

    import java.math.BigInteger;

    //import java.security.interfaces.*;

  • 8/6/2019 Digital Image Doc

    72/95

    //import java.security.KeyException;

    import java.io.BufferedReader;

    import java.io.BufferedWriter;

    import java.io.InputStream;

    import java.io.OutputStream;

    import javax.crypto.spec.*;import java.security.spec.*;

    import java.applet.*;

    import java.net.*;

    import java.net.SocketException;

    import java.net.BindException;

    import java.net.URL;

    import javax.swing.Timer;

    import javax.swing.TransferHandler;

    public class Encryption extends JFrame implements ActionListener,Serializable{

    JLabel label1;JLabel label2;

    JLabel label3;

    JButton button1;

    JButton button2;

    JTextField textfield1;

    JTextArea textarea2;

    JScrollPane sp_textarea2;

    JPasswordField passwordfield3;

    JButton button3;

    JButton button4;

    JButton button5;

    JButton button6;

    JFileChooser filechooser;

    File f,tempfilename,Ofilename,Sfilename;

    int Copened,Cencrypt,Csave;

    InetAddress ipaddress;

    String name,Ekey,address;

    String chosenFile;

    InputStream ins;

    OutputStream outs;

    Thread t;

    public Encryption()

    {

    EncryptionLayout customLayout = new EncryptionLayout();

    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));

  • 8/6/2019 Digital Image Doc

    73/95

    getContentPane().setLayout(customLayout);

    //getContentPane().setBackground(Color.LIGHT_GRAY);

    label1 = new JLabel("SOURCE");

    getContentPane().add(label1);

    label1.setFont(new Font("Garamond", Font.BOLD, 16));

    label2 = new JLabel("MESSAGE");

    getContentPane().add(label2);

    label2.setFont(new Font("Garamond", Font.BOLD, 16));

    label3 = new JLabel("KEY");

    label3.setVisible(false);

    getContentPane().add(label3);

    label3.setFont(new Font("Garamond", Font.BOLD, 16));

    button1 = new JButton("BACK");getContentPane().add(button1);

    button1.addActionListener(this);

    button1.setFocusable(true);

    button1.setRolloverEnabled(true);

    button1.setContentAreaFilled(true);

    button1.setBorderPainted(true);

    button1.setVerifyInputWhenFocusTarget(true);

    button1.setFont(new Font("Garamond", Font.BOLD, 16));

    button2 = new JButton("NEXT");

    getContentPane().add(button2);

    button2.setFocusable(true);

    button2.setContentAreaFilled(true);

    button2.setBorderPainted(true);

    button2.setRolloverEnabled(true);

    button2.setVerifyInputWhenFocusTarget(true);

    button2.addActionListener(this);

    button2.setFont(new Font("Garamond", Font.BOLD, 16));

    textfield1 = new JTextField("");

    getContentPane().add(textfield1);

    textfield1.setEditable(false);

    textfield1.setBackground(Color.LIGHT_GRAY);

    textfield1.setToolTipText("Choose the image file to be encrypted");

    textarea2 = new JTextArea("");

    getContentPane().add(textarea2);

    textarea2.setFocusable(true);

  • 8/6/2019 Digital Image Doc

    74/95

    GraphicsEnvironment.getLocalGraphicsEnvironment();

    textarea2.setAutoscrolls(true);

    textarea2.setWrapStyleWord(true);

    textarea2.setBackground(Color.LIGHT_GRAY);

    textarea2.setToolTipText("Enter the message to be embedded with image");

    sp_textarea2 = new JScrollPane(textarea2);

    getContentPane().add(sp_textarea2);

    passwordfield3 = new JPasswordField("");

    getContentPane().add(passwordfield3);

    passwordfield3.setVisible(false);

    passwordfield3.setToolTipText("Enter a 6 digit KEY");

    button3 = new JButton("BROWSE");

    getContentPane().add(button3);

    button3.addActionListener(this);button3.setFocusable(true);

    button3.setContentAreaFilled(true);

    button3.setBorderPainted(true);

    button3.setRolloverEnabled(true);

    button3.setVerifyInputWhenFocusTarget(true);

    button3.setFont(new Font("Garamond", Font.BOLD, 16));

    button4 = new JButton("CLEAR");

    getContentPane().add(button4);

    button4.setFocusable(true);

    button4.setContentAreaFilled(true);

    button4.setBorderPainted(true);

    button4.setToolTipText("Clears the Textarea");

    button4.setRolloverEnabled(true);

    button4.setVerifyInputWhenFocusTarget(true);

    button4.addActionListener(this);

    button4.setFont(new Font("Garamond", Font.BOLD, 16));

    button5 = new JButton("SAVE");

    getContentPane().add(button5);

    button5.setFocusable(true);

    button5.setContentAreaFilled(true);

    button5.setBorderPainted(true);

    button5.setToolTipText("Saves the Encrypted image file");

    button5.setRolloverEnabled(true);

    button5.setVerifyInputWhenFocusTarget(true);

    button5.addActionListener(this);

    button5.setFont(new Font("Garamond", Font.BOLD, 16));

  • 8/6/2019 Digital Image Doc

    75/95

    button6 = new JButton("SEND");

    getContentPane().add(button6);

    button6.setFocusable(true);

    button6.setContentAreaFilled(true);

    button6.setBorderPainted(true);

    button6.setToolTipText("Sends the Encrypted image file to the remotemachine");

    button6.setRolloverEnabled(true);

    button6.setVerifyInputWhenFocusTarget(true);

    button6.addActionListener(this);

    button6.setFont(new Font("Garamond", Font.BOLD, 16));

    button6.setVisible(false);

    Copened=0;

    Cencrypt=0;

    Csave=0;

    filechooser=new JFileChooser();

    filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    setSize(getPreferredSize());

    addWindowListener(new WindowAdapter() {

    public void windowClosing(WindowEvent e) {

    System.exit(0);

    }

    });

    }

    public static void main(String args[]) {

    Encryption en = new Encryption();

    en.setTitle("Encryption");

    en.show();

    en.pack();

    JFrame.setDefaultLookAndFeelDecorated(true);

    JDialog.setDefaultLookAndFeelDecorated(true);

    try

    {

    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAnd

    Feel");

    //javax.swing.UIManager.setLookAndFeel("com.birosoft.liquid.Liqui

    dLookAndFeel");

  • 8/6/2019 Digital Image Doc

    76/95

    }

    catch (Exception ex)

    {

    System.out.println("Failed loading L&F: ");

    System.out.println(ex);

    }

    }

    public void Imageencrypt(String message,File file,int key) throws

    java.io.IOException

    {

    byte b[]=new byte[2];

    BigInteger Abi,Mbi;

    int k,k1;

    DataInputStream ins=new DataInputStream(new FileInputStream(file));

    DataOutputStream outs=new DataOutputStream(new FileOutputStream(newFile("1.jpg")));

    for(int c=0;c

  • 8/6/2019 Digital Image Doc

    77/95

    int Alen=Abi.bitLength();

    if(b[0]

  • 8/6/2019 Digital Image Doc

    78/95

    {

    if(Alen==Abi.bitLength())

    {

    BigInteger bi=new BigInteger("1111111111111110",2);

    BigInteger big=Abi.and(bi);

    b=big.toByteArray();}

    else

    {

    BigInteger bi=new BigInteger("-1",2);

    BigInteger big=Abi.subtract(bi);

    b=big.toByteArray();

    }

    }

    else if(Clen[j-k]=='1' && Ach[Alen-1]=='0')

    {

    if(Alen==Abi.bitLength()){

    BigInteger bi=new BigInteger("1",2);

    BigInteger big=Abi.add(bi);

    b=big.toByteArray();

    }

    else

    {

    BigInteger bi=new BigInteger("-1",2);

    BigInteger big=Abi.add(bi);

    b=big.toByteArray();

    }

    }

    outs.write(b);

    } // end else

    } // for loop j

    } // end of if

    else

    {

    String slen=String.valueOf(chmess[i-1]);

    byte blen[]=slen.getBytes();

    BigInteger Blen=new BigInteger(blen);

    String Slen=Blen.toString(2);

    char Clen[]=new char[Blen.bitLength()];

    Slen.getChars(0,Blen.bitLength(),Clen,0);

    for(int j=0;j

  • 8/6/2019 Digital Image Doc

    79/95

    {

    if(j==0)

    {

    for(k1=0;k1

  • 8/6/2019 Digital Image Doc

    80/95

    Abi=new BigInteger(b);

    String Aby=Abi.toString(2);

    int Alen=Abi.bitLength();

    if(b[0]

  • 8/6/2019 Digital Image Doc

    81/95

    } // end of else

    } // for loop i

    while(true)

    {int i=ins.read();

    if(i==-1) break;

    outs.write(i);

    }

    ins.close();

    outs.close();

    }

    public void actionPerformed(ActionEvent e)

    {

    try

    {

    String cmd;

    cmd=e.getActionCommand();

    if(cmd.equals("BACK"))

    {

    dispose();

    Stegno s = new Stegno();

    s.show();

    s.pack();

    s.setTitle("Main Menu - Implementation of Steganography");

    }

    if(cmd.equals("CLEAR"))

    {

    textarea2.setText("");

    }

    if(cmd.equals("SAVE"))

    {

    if(Copened==1 && Cencrypt==1)

    {

    int r=filechooser.showSaveDialog(this);

    Sfilename=filechooser.getSelectedFile();

    FileInputStream in=new FileInputStream("1.jpg");

    FileOutputStream out=new FileOutputStream(Sfilename);

    Ofilename=Sfilename;

  • 8/6/2019 Digital Image Doc

    82/95

    textfield1.setEditable(true);

    textfield1.setText(Sfilename.getPath());

    textfield1.setEditable(false);

    while(true)

    {int i=in.read();

    if(i==-1) break;

    out.write(i);

    }

    in.close();

    out.close();

    JOptionPane.showMessageDialog(null,"\nYour image file has been encrypted

    and saved successfully\n","message",JOptionPane.INFORMATION_MESSAGE);

    }else

    {

    String m;

    if(Copened==0)

    m="File not Opened";

    else if(Cencrypt==0)

    m="Not Encrypted";

    else

    m="Not Decrypted";

    JOptionPane.showMessageDialog(this,m,"Error",JOptionPane.ERROR_MESSAG

    E);

    }

    }

    if(cmd.equals("NEXT"))

    {

    if(Copened==1)

    {

    Ekey=JOptionPane.showInputDialog("Enter 4 digit Key For Encryption");

    //String type

    if(Ekey==null)

    {

    JOptionPane.showMessageDialog(this,"Enter only 4 Digit

    key","Error",JOptionPane.ERROR_MESSAGE);

  • 8/6/2019 Digital Image Doc

    83/95

    }

    if(Ekey.trim().length()4)

    JOptionPane.showMessageDialog(this,"Enter only 4 Digit

    key","Error",JOptionPane.ERROR_MESSAGE);

    else

    {

    // encrypt the message

    int key=Integer.parseInt(Ekey);

    Imageencrypt(textarea2.getText(),Ofilename,key);

    Cencrypt=1;}

    }

    else

    {

    JOptionPane.showMessageDialog(this,"File

    NotOpened","Error",JOptionPane.ERROR_MESSAGE);

    }

    }

    if(cmd.equals("BROWSE"))

    {

    int r=filechooser.showOpenDialog(this);

    tempfilename=filechooser.getSelectedFile(); //File type

    if(r==JFileChooser.CANCEL_OPTION)

    JOptionPane.showMessageDialog(this,"FileNotSelected","Error",JOptionPane

    .ERROR_MESSAGE);

    else

    {

    String name=tempfilename.getName();

    if((!name.endsWith(".jpg")) && !name.endsWith(".gif") && !

    name.endsWith(".bmp")&& !name.endsWith(".jpeg"))

    JOptionPane.showMessageDialog(this,"Select Only Image

    file","Error",JOptionPane.ERROR_MESSAGE);

    else

    {

  • 8/6/2019 Digital Image Doc

    84/95

    Copened=1;

    Ofilename=tempfilename;

    textfield1.setText(name);

    textfield1.setText(tempfilename.getPath());

    textfield1.setFont(new Font("Century",Font.PLAIN,15));

    textfield1.setBackground(Color.LIGHT_GRAY);textfield1.setEditable(false);

    }

    }

    }

    } // end try

    catch(Exception xe)

    {

    //xe.printStackTrace();

    JOptionPane.showMessageDialog(this,xe,"Error",JOptionPane.ERROR_MESSAGE);

    }

    } // end of actionperformed

    } // End of class

    class EncryptionLayout implements LayoutManager {

    public EncryptionLayout() {

    }

    public void addLayoutComponent(String name, Component comp) {

    }

    public void removeLayoutComponent(Component comp) {

    }

    public Dimension preferredLayoutSize(Container parent) {

    Dimension dim = new Dimension(0, 0);

    Insets insets = parent.getInsets();

    dim.width = 700 + insets.left + insets.right;

    dim.height = 400 + insets.top + insets.bottom;

    return dim;

    }

    public Dimension minimumLayoutSize(Container parent) {

    Dimension dim = new Dimension(0, 0);

  • 8/6/2019 Digital Image Doc

    85/95

    return dim;

    }

    public void layoutContainer(Container parent) {

    Insets insets = parent.getInsets();

    Component c;

    c = parent.getComponent(0);

    if (c.isVisible()) {c.setBounds(insets.left+75,insets.top+74,112,32);}

    c = parent.getComponent(1);

    if (c.isVisible()) {c.setBounds(insets.left+75,insets.top+170,112,32);}

    c = parent.getComponent(2);

    if (c.isVisible()) {c.setBounds(insets.left+88,insets.top+160,112,32);}

    c = parent.getComponent(3);

    if (c.isVisible()) {c.setBounds(insets.left+145,insets.top+294,124,38);}

    c = parent.getComponent(4);

    if (c.isVisible()) {c.setBounds(insets.left+300,insets.top+294,124,38);}c = parent.getComponent(5);

    if (c.isVisible()) {c.setBounds(insets.left+158,insets.top+74,390,32);}

    c = parent.getComponent(6);

    if (c.isVisible()) {c.setBounds(insets.left+158,insets.top+120,390,150);}

    c = parent.getComponent(7);

    if (c.isVisible()) {c.setBounds(insets.left+200,insets.top+160,284,52);}

    c = parent.getComponent(8);

    if (c.isVisible()) {c.setBounds(insets.left+558,insets.top+74,114,35);}

    c = parent.getComponent(9);

    if (c.isVisible()) {c.setBounds(insets.left+558,insets.top+173,114,35);}

    c = parent.getComponent(10);

    if (c.isVisible()) {c.setBounds(insets.left+450,insets.top+294,124,38);}

    c = parent.getComponent(11);

    if (c.isVisible()) {c.setBounds(insets.left+559,insets.top+204,114,35);}

    }

    }

  • 8/6/2019 Digital Image Doc

    86/95

    import java.awt.*;

    import java.awt.event.*;

    import javax.swing.*;

    import java.util.*;

    import javax.swing.Icon;

    import java.lang.*;

    import java.util.*;

    import java.text.*;

    import javax.swing.Icon;

    import java.awt.event.ActionListener;

    import java.awt.event.ActionEvent;

    import java.io.Serializable;

    public class Stegno extends JFrame implements ActionListener,Serializable{

    JLabel label1;

    ButtonGroup cbg;

    JRadioButton radio1;

    JRadioButton radio2;

    JButton button1;

    JTextField timeField;

    JTextField dateLongField;

    JMenuBar menuBar=new JMenuBar();

    JMenuItem TopicsItem=new JMenuItem("Topics");

    JRadioButton radio3;

    public Stegno(){

    StegnoLayout customLayout = new StegnoLayout();

    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));

    getContentPane().setLayout(customLayout);

  • 8/6/2019 Digital Image Doc

    87/95

    //getContentPane().setBackground(Color.LIGHT_GRAY);

    label1 = new JLabel("DIGITAL SECURITY USING STEGANOGRAPHY");

    getContentPane().add(label1);

    label1.setFont(new Font("RockWell", Font.BOLD, 27));

    cbg = new ButtonGroup();

    radio1 = new JRadioButton("ENCRYPTION", false);

    cbg.add(radio1);

    getContentPane().add(radio1);

    radio1.setFocusable(true);

    radio1.setRolloverEnabled(true);

    radio1.setVerifyInputWhenFocusTarget(true);

    radio1.addActionListener(this);

    radio1.setFont(new Font("Engravers MT", Font.BOLD, 20));

    radio2 = new JRadioButton("DECRYPTION", false);

    cbg.add(radio2);

    getContentPane().add(radio2);

    radio2.addActionListener(this);

    radio2.setFocusable(true);

    radio2.setRolloverEnabled(true);

    radio2.setVerifyInputWhenFocusTarget(true);

    radio2.setFont(new Font("Engravers MT", Font.BOLD, 20));

    button1 = new JButton("EXIT");

    getContentPane().add(button1);

    button1.addActionListener(this);

  • 8/6/2019 Digital Image Doc

    88/95

    button1.setFocusable(true);

    button1.setRolloverEnabled(true);

    button1.setVerifyInputWhenFocusTarget(true);

    //button1.setSelected(true);

    button1.setFont(new Font("Engravers MT", Font.BOLD, 18));

    timeField = new JTextField(5);

    showSysTime(timeField);

    timeField.setFont(new Font("TimesRoman",Font.BOLD,12));

    // timeField.setForeground(Color.GRAY);

    timeField.setEditable(false);

    getContentPane().add(timeField);

    dateLongField = new JTextField(18);

    dateLongField.setText(showTodayDate());

    getContentPane().add(dateLongField);

    dateLongField.setEditable(false);

    //dateLongField.setForeground(Color.GRAY);

    dateLongField.setFont(new Font("TimesRoman",Font.BOLD,12));

    JMenu helpMenu=new JMenu("Help");

    helpMenu.setMnemonic('h');

    TopicsItem.addActionListener(this);

    helpMenu.add(TopicsItem);

    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    radio3 = new JRadioButton("SEND IMAGE", false);

    cbg.add(radio3);

  • 8/6/2019 Digital Image Doc

    89/95

    getContentPane().add(radio3);

    radio3.setFocusable(true);

    radio3.setRolloverEnabled(true);

    radio3.setVerifyInputWhenFocusTarget(true);

    radio3.addActionListener(this);

    radio3.setFont(new Font("Engravers MT", Font.BOLD, 20));

    setSize(getPreferredSize());

    addWindowListener(new WindowAdapter() {

    public void windowClosing(WindowEvent e) {

    System.exit(0);

    }

    });

    }

    public void showSysTime(final JTextField tf)

    {

    final SimpleDateFormat timef = new

    SimpleDateFormat("HH:mm:ss");

    javax.swing.Timer timer = new javax.swing.Timer(1000, new

    ActionListener()

    {

    public void actionPerformed(ActionEvent e)

    {

    String s = timef.format(new

    Date(System.currentTimeMillis()));

    tf.setText(s);

    }

    });

    timer.start();

  • 8/6/2019 Digital Image Doc

    90/95

    }

    public String showTodayDate()

    {

    Date dt = new Date();

    System.out.println(dt.toString());

    SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d,

    yyyy");

    return sdf.format(dt).toString();

    }

    public void actionPerformed(ActionEvent e)

    {

    String cmd;

    cmd = e.getActionCommand();

    if(e.getSource() == radio1)

    {

    dispose();

    Encryption en = new Encryption();

    en.setTitle("ENCRYPTION");

    en.pack();

    en.show();

    }

    if(e.getSource() == radio2)

    {

    dispose();

    Decryption dn = new Decryption();

    dn.setTitle("DECRYPTION");

    dn.pack();

  • 8/6/2019 Digital Image Doc

    91/95

    dn.show();

    }

    if(e.getSource()==radio3)

    {

    dispose();

    SendImage si=new SendImage();

    si.setTitle("Uploads the encrypted image");

    si.show();

    si.pack();

    }

    if(e.getSource()==TopicsItem)

    {

    try

    {

    Runtime run= Runtime.getRuntime();

    run.exec("notepad help.txt");

    }

    catch(Exception ee)

    {

    System.out.println("Error: "+ ee);

    }

    }

    if(cmd.equals("EXIT"))

    {

    int res;

    res = JOptionPane.showConfirmDialog(this, "R U SURE U WANT TO EXIT");

    switch(res)

    {

  • 8/6/2019 Digital Image Doc

    92/95

    case JOptionPane.OK_OPTION:

    System.exit(0);

    break;

    case JOptionPane.NO_OPTION:

    break;

    }

    }

    }

    public static void main(String args[]){

    Stegno s = new Stegno();

    s.setTitle("Main Menu");

    s.pack();

    s.show();

    JFrame.setDefaultLookAndFeelDecorated(true);

    JDialog.setDefaultLookAndFeelDecorated(true);

    try

    {

    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAnd

    Feel");

    //

    javax.swing.UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel

    ");

    }

  • 8/6/2019 Digital Image Doc

    93/95

    catch (Exception ex)

    {

    System.out.println("Failed loading L&F: ");

    System.out.println(ex);

    }

    }

    }

    class StegnoLayout implements LayoutManager {

    public StegnoLayout() {

    }

    public void addLayoutComponent(String name, Component comp) {

    }

    public void removeLayoutComponent(Component comp) {

    }

    public Dimension preferredLayoutSize(Container parent) {

    Dimension dim = new Dimension(0, 0);

    Insets insets = parent.getInsets();

    dim.width = 700 + insets.left + insets.right;

    dim.height = 400 + insets.top + insets.bottom;

    return dim;

    }

    public Dimension minimumLayoutSize(Container parent) {

  • 8/6/2019 Digital Image Doc

    94/95

    Dimension dim = new Dimension(0, 0);

    return dim;

    }

    public void layoutContainer(Container parent) {

    Insets insets = parent.getInsets();

    Component c;

    c = parent.getComponent(0);

    if (c.isVisible()) {c.setBounds(insets.left+45,insets.top+30,648,42);}

    c = parent.getComponent(1);

    if (c.isVisible()) {c.setBounds(insets.left+235,insets.top+108,240,48);}

    c = parent.getComponent(2);

    if (c.isVisible()) {c.setBounds(insets.left+235,insets.top+170,240,48);}

    c = parent.getComponent(3);

    if (c.isVisible()) {c.setBounds(insets.left+260,insets.top+310,184,48);}

    c = parent.getComponent(4);

    if (c.isVisible()) {c.setBounds(insets.left+536,insets.top+378,58,22);}

    c = parent.getComponent(5);

    if (c.isVisible()) {c.setBounds(insets.left+593,insets.top+378,105,22);}

    c = parent.getComponent(6);

    if (c.isVisible()) {c.setBounds(insets.left+235,insets.top+232,240,48);}

    }

    }

  • 8/6/2019 Digital Image Doc

    95/95

    8. REFERNCE

    F. Alturki and R. Mersereau, A Novel Approach for Increasing Security and Data

    Embedding Capacity in Images for Data

    Hiding Applications.Proc. of ITCC, Las Vegas, Nevada, 2001, pp. 228233.2. S. Dumitrescu, Wu Xiaolin, and Z. Wang, Detection of LSB Steganography via

    Sample Pair Analysis.Preproceedings 5thInformation Hiding Workshop, Noordwijkerhout, Netherlands, Oct. 79, 2002.

    3. J. Fridrich, M. Goljan, and R. Du, Detecting LSB Steganography in Color and Gray-Scale Images, Magazine of IEEE

    Multimedia, Special Issue on Security, October-November issue, 2001, pp. 2228.

    4. J.J. Harmsen and W. A. Pearlman, Steganalysis of Additive Noise Modelable

    Information Hiding,Proc. SPIE ElectronicImaging, Santa Clara, January 2124, 2003.

    5. G.E. Healey and R. Kondepudy, Radiometric CCD Camera Calibration and NoiseEstimation. IEEE Trans. on Pattern Analysis

    and Machine Intelligence, Vol. 16(3), March 1994, pp. 267276.

    6. M. Holliman, N. Memon, and M. M. Yeung, On the Need for Image Dependent Keys

    for Watermarking,Proc. Content

    Security and Data Hiding in Digital Media, Newark, NJ, May 14, 1999.

    7. L.M. Marvel, C.G. Boncelet, and C.T. Retter, Reliable Blind Information Hiding for

    Images. In: D. Aucsmith (eds.):Information Hiding: 2nd International Workshop, LNCS, Vol. 1525. Springer-Verlag,

    New York, 1998, pp. 4861.

    8. T. Sharp, An Implementation of Key-Based Digital Signal Steganography, In: I. S.Moskowitz (eds.): 4th International

    Workshop on Information Hiding, LNCS 2137, Springer-Verlag, New York, 2001, pp.

    1326.9. A. Westfeld and A. Pfitzmann, Attacks on Steganographic Systems. In: A. Pfitzmann

    (eds.): 3rd International Workshop onInformation Hiding. LNCS, Vol.1768. Springer-Verlag, New York, 2000, pp. 6175.

    10 A W tf ld Hi h C it D it B tt St l i (F5 A St hi