1 a java framework for experimentation with steganography dr. kenny hunt the university of wisconsin...

Post on 24-Dec-2015

215 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

A Java Framework for Experimentation with SteganographyDr. Kenny HuntThe University of Wisconsin – La Crosse

2

Overview

Definitions Overview of LSB technique Software architecture Discussion Demo

3

Definitions Steganography

“the art of concealing the existence of information within seemingly innocuous carriers”

“an encrypted message may draw suspicion while a hidden message will not”

Neil Johnson

Image Processing and Steganography “the art of concealing the existence of

information within seemingly innocuous digital images”

4

Background(Bit Planes)

An Image is a 2D array of pixels Each pixel (in gray-scale) is 8 bits Each bit carries information

Not all bits carry the same amount

A7 A6 A5 A4 A3 A2 A1 A0

128 64 32 16 8 4 2 1

Binary Representation of 25

A7 A6 A5 A4 A3 A2 A1 A0

0 0 0 1 1 0 0 1

Binary Representation of 153

A7 A6 A5 A4 A3 A2 A1 A0

1 0 0 1 1 0 0 1

Binary Representation of 24

A7 A6 A5 A4 A3 A2 A1 A0

0 0 0 1 1 0 0 0

5

Bit PlanesA0

A7

One pixel split into it’s 8-bits

6

Background(Bit Planes)

White indicates an ON bit and black an OFF bit

(a) 8-bit grayscale source image (b) Most significant bit plane (a7) of the source(c) Least significant bit plane (a0) of the source(d) Bit plane a4 of the source image

(a) (b) (c) (d)

7

The Big Idea(LSB embedding)

An image contains more information than can be perceived. Replace the “imperceptible bits” of a cover image with the

bits of a “secret message”.

CoverImage

A0A1A2A3A4A5A6A7

SecretMessage

M0M1M2A3A4A5A6A7

Stego Image(Cover image with message)

The Challenge:

Write Java code to LSB embed a secret message in an image. The secret message can be “any object”.

8

Java Framework Design a set of classes to perform LSB embedding Isolate the task of embedding/extracting

<<interface>>Steganographer

+embed(cover:BufferedImage, msg:Object):BufferedImage+extract(stego:BufferedImage):Object

LSBSteganographer

+embed(cover:BufferedImage, msg:Object):BufferedImage+extract(stego:BufferedImage):Object+getChannelCapacity():int+setChannelCapacity(channels:int)

9

Java Framework

ImageInputStream extends InputStream

+ImageInputStream(source:BufferedImage, numChannels:int)+hasMoreBits():boolean+getNextBit():int+getNextByte():int+read():int

ImageOutputStream extends OutputStream

+ImageOutputStream(destination:BufferedImage, numChannels:int)+hasMoreBits():boolean+writeBit(int b)+writeByte(int b)+write(int b)

Isolate the task of writing/reading data to/from an image

10

Java Framework

class ImageOutpuStream extends OutputStream { private BufferedImage buffer; private int row, col, band, channel, numChannels;

// The least significant bit of b is written to the buffer public void writeBit(int b) throws IOException { if(!hasMoreBits()) throw new IOException(“Out of capacity”); int newPixel = buffer.getRaster().getSample(col,row,band); newPixel = setBit(newPixel, b, channel); buffer.getRaster().setSample(col,row,band,newPixel); advanceIndices(); } }}

Implement the task of writing to an image Maintain row, column, band, channel as an “insertion point”

The writeByte and write methods are then built on the writeBit.The writeByte and write methods are then built on the writeBit.

11

Java Framework(humor me…assume the message is an image)

class LSBSteganographer implements Steganographer { private int numberOfChannels;

public Image embed(BufferedImage cover, Object message) { Image result = cover.copy(); int k = getNumberOfChannels(); OutputStream rOut = new ImageOutputStream(result, k); writeHeaderInformation(message, rout); for every pixel P in message rOut.writeByte(P); return result; }}

This code writes image data to an OutputStream. Java has code that does this!

12

Java Framework(assume the message is an image)

class LSBSteganographer implements Steganographer { private int numberOfChannels;

public Image embed(BufferedImage cover, Object message) { Image result = cover.copy(); int k = getNumberOfChannels(); OutputStream rOut = new ImageOutputStream(result, k); ImageIO.write((BufferedImage)message, “PNG”, rout); return result; }}

Real live honest-to-goodness Java code!

What if the message is not an image? Can we embed it in the cover?

13

Java Framework(assume the message is NOT an image)

class LSBSteganographer implements Steganographer { private int numberOfChannels;

public Image embed(BufferedImage cover, Object message) { Image result = cover.copy(); int k = getNumberOfChannels(); OutputStream rOut = new ImageOutputStream(result, k); DataOutputStream fout = new DataOutputStream(rOut); fout.writeObject(message); return result; }}

Real live honest-to-goodness Java code!

The contract for “writeObject” is that the written object be “Serializable”. BufferedImages are not. Therefore, must make a specific exception for image types.

Image from http://i33www.ira.uka.de/applets/mocca/images/janus.gif

14

Java Framework(make no assumptions!)

class LSBSteganographer implements Steganographer { private int numberOfChannels;

public Image embed(BufferedImage cover, Object message) { Image result = cover.copy(); int k = getNumberOfChannels(); OutputStream rOut = new ImageOutputStream(result, k); if(message instanceof Serializable) { DataOutputStream fout = new DataOutputStream(rOut); fout.writeObject(message); } else if(message instanceof BufferedImage) { ImageIO.write(message, “PNG”, rout); } else throw new IllegalArgumentException(); return result; }}

Image from http://i33www.ira.uka.de/applets/mocca/images/janus.gif

15

Classroom Use Assignment given in an Image

Processing course Emphasizes bit-level operations

Could even give the UML class diagrams

Emphasizes good software design Could even give the students low-level

code

I give no design or code Review the design at the conclusion of the

exercise

top related