Вы находитесь на странице: 1из 52

ANDROID-BASED MOBILE PAYMENT SERVICE PROTECTED BY 3FACTOR AUTHENTICATION AND VIRTUAL PRIVATE AD HOC

NETWORKING
ABSTRACT
This work develops a pair of mobile payment devices, a counter reader and a paying
client, on Android-based smartphone platforms for emerging mobile payment or electronic wallet
services. These two devices featuring 3-factor authentication and virtual private Ad Hoc
networking can make an easier and securer transaction than traditional credit cards or electronic
payment cards. 3-factor authentication feature combines PIN code authentication, USIM card
authentication, and facial face authentication. Especially, this work proposes and implements a
simple but practical method, Fast Semi-3D Face Vertical Pose Recovery, to cope with the vertical
pose variation issue bothering face recognition systems so far. Experimental results show the
proposed method can significantly raise the recognition accuracy and enlarge the operating angle
range of face recognition system under various vertical pose conditions. Besides, virtual private
Ad Hoc networking feature based on OpenSSL and i-Jetty open-source libraries is also integrated
seamlessly.

EXISTING SYSTEM
Since the cellphone embedded with a Universal Subscriber Identity Module (USIM) card has
become the most widespread device that human beings have ever created and brought along,
global telecom operators are unexceptionally engaged in mobile payment service to share the
ever-increasing electronic payment card market.
Besides, mobile payment technology not only can be applied to micropayment transactions as a
coin wallet, but also can be extensively applied to public transportations electronic ticketing,
vending machines, membership cards, smart poster interaction, house electronic keys, car smart
keys, official digital signatures, and so on.
However, it will be possibly prevalent only if the mobile payment service can be used more
rapidly, conveniently, and securely than cash or credit card transactions.

DISADVANTAGES OF THE EXISTING SYSTEM

The existing system has insecure or less secured transaction occurs from the

client.

The security issue of Ad Hoc networking between the mobile payment counter

reader and the mobile payment paying client is also critical

PROPOSED SYSTEM

In order to protect the transaction itself with the lowest risk, 3-factor authentication feature is
effective and necessary. 3-factor authentication involves three different kinds of identification
procedures:

what the paying client knows (e.g., secret phrase, password, PIN code),

what the paying client has (e.g., token, electronic card, passport), and

what the paying client characterizes (e.g. behavioral or biometric feature).

Only mobile payment service based on the Android-based smartphone platforms can
accomplishes all requirements of 3-factor authentication easily and completely, but traditional
credit cards or electronic payment cards can not.
Because the more factors the authentication chooses, the more robust the defense strength of the
transaction itself gets, 3-factor authentication feature has become the fundamental and common
authentication standard adopted by global mobile telecom operators for promotion of mobile
payment service.

ADVANTAGES OF THE PROPOSED SYSTEM

Virtual private Ad Hoc networking feature in this work is a safer and cheaper for

promotion of mobile payment service.

Low-power and high-portability Android-based smartphone platforms are adopted to

implement a pair of mobile payment devices

The mobile payment reader in this work is suitably deployed in any temporary outdoor

business activities are usually out of electric power and Wi-Fi access point.
SYSTEM REQUIRMENTS

SOFTWARE REQUIREMENTS
Development IDE

Eclipse

Android SDK

4.1

Database

SQL Lite

Hard disk

50GB

Processor

Dual Core Processor

Monitor

17Color Monitor

HARDWARE REQUIREMENTS

ALGORITHM USED

ENCRYPTION ALGORITHM

Encryption is the process of converting a plaintext message into cipher text which can be
decoded back into the original message. An encryption algorithm along with a key is used in the
encryption and decryption of data. There are several types of data encryptions which form the
basis of network security. Encryption schemes are based on block or stream ciphers.
The type and length of the keys utilized depend upon the encryption algorithm and the
amount of security needed. In conventional symmetric encryption a single key is used. With this
key, the sender can encrypt a message and a recipient can decrypt the message but the security of
the key becomes problematic. In asymmetric encryption, the encryption key and the decryption
key are different. One is a public key by which the sender can encrypt the message and the other
is a private key by which a recipient can decrypt the message.

PREPROCESSING ALGORITHM
Preprocessing images commonly involves removing low-frequency background noise,

normalizing the intensity of the individual particles images, removing reflections, and masking
portions of images. Image preprocessing is the technique of enhancing data images prior to
computational processing.

MODULES:
Adhoc Network:
This work develops and ports Secure Sockets Layer (SSL) protocol to put some
encryption algorithm on the Ad Hoc wireless channel as a Virtual Private Network (VPN),
DFD:

Screen Shots:

PIN Authentication:
Input of this authentication is what the paying client knows. Like secret phrase, password,
PIN code and etc In this project we are using UserName and Password. This client information
is stored in confidential database. It is using to get information (Mobile Number and Face input)
of every client.

Screen Shots:

USIM Authentication:

Input of this Authentication is what the paying client has. Like token, electronic card,
passport and Mobile Number.

DFD:

Screen Shots:

Face Authentication:
The Final Authentication of this project is what the paying client characterizes. Like
Finger Print, Face and IRIS.

DFD:

Screen Shots:

SYSTEM REQUIRMENTS
SOFTWARE REQUIREMENTS
Development IDE

Eclipse

Android SDK

4.1

Database

SQL Lite

Hard disk

50GB

Processor

Dual Core Processor

Monitor

17Color Monitor

HARDWARE REQUIREMENTS

LITERATURE SURVEY
Title:
Fast face identification under varying pose from a single 2-D model view
Authors:
Gao, Y., Leung, M.K.H.; Wang, W.; Hui, S.C.
Description:
One of the key remaining problems in face recognition is that of handling the variability
in appearance due to changes in pose. The authors present a simple and computationally efficient
3-D pose recovery methodology. It addresses the computationally expensive problem of current
generic 3-D model pose recovery methods and thus is able to be used in real-time applications.
Compared with the virtual view methods, the face identification system with the proposed pose
recovery method demands much less storage space as it transforms the 2-D rotated face to the 2D fronto-parallel view for subsequent identification rather than generating multiple virtual views
for a single input face. Experiments evaluating the effectiveness of the technique are reported.
The systems are compared with human performances and existing techniques

Title:
Pose normalization for robust face recognition based on statistical affine
transformation
Authors:
Xiujuan Chai, Shiguang Shan ; Wen Gao
Description:
A framework for pose-invariant face recognition using the pose alignment method is
described in this paper. The main idea is to normalize the face view in depth to frontal view as
the input of face recognition framework. Concretely, an inputted face image is first normalized
using the irises information, and then the pose subspace algorithm is employed to perform the
pose estimation. To model the pose-invariance, the face region is divided into three rectangles
with different mapping parameters in this pose alignment algorithm. So the affine transformation
parameters associated with the different poses can be used to align the input pose image to
frontal view. To evaluate this algorithm objectively, the views after the pose alignment are
incorporated into the frontal face recognition system. Experimental results show that it has the
better performance and it increases the recognition rate statistically by 17.75% under the pose
that rotated within 30 degree.

Title:
Automatic interpretation and coding of face images using flexible models
Authors:
Lanitis,A. Taylor, C.J.; Cootes, T.F..

Description:
Face images are difficult to interpret because they are highly variable. Sources of
variability include individual appearance, 3D pose, facial expression, and lighting. We describe a
compact parametrized model of facial appearance which takes into account all these sources of
variability. The model represents both shape and gray-level appearance, and is created by
performing a statistical analysis over a training set of face images. A robust multiresolution
search algorithm is used to fit the model to faces in new images. This allows the main facial
features to be located, and a set of shape, and gray-level appearance parameters to be recovered.
A good approximation to a given face can be reconstructed using less than 100 of these
parameters. This representation can be used for tasks such as image coding, person identification,
3D pose recovery, gender recognition, and expression recognition. Experimental results are
presented for a database of 690 face images obtained under widely varying conditions of 3D
pose, lighting, and facial expression. The system performs well on all the tasks listed above.

SYSTEM ARCHITECTURE

Databas
e

Billing
Device

Mobile No, User


Pin and face
image

Mobile
Device

DATA FLOW DIAGRAM

START

Pair Client mobile and Billing


Device through WIFI

Login Authentication Using


Username and Password and
FACE image
Match User Mobile Number
and PIN and face image
verification

Bill Payed

End

UML DIAGRAMS:
CLASS DIAGRAM

CLIENT MOBILE
CONNECTION ESTABLISHMENT()
LOGIN ATTEMP()
PAY BILL()

PAYING DEVICE
CONNECTION ESTABLISHMENT()
PIN CODE()
USIM AUTHENTICATION()
IFACE IMAGE AUTHENTICATION()

DATABASE
3 FACTOR VERIFICATION()
TRANSACTION SAVED()

USECASE DIAGRAM

PARING DEVICES USING WIFI

LOGIN ATTEMPT

BILLING DEVICE
USERNAME AND PASSWORD

CLIENT MOBILE
USIM AUTHENTICATION

FACE IMAGE AUTHENTICATION

DATABASAE

3-FACTOR VERIFICATION

BILL PAYED

SEQUENCE DIAGRAM

BILLING DEVICE

CLIENT MOBILE

DATABASE

CONNECTING USING WIFI

CONNECTION MADE

LOGIN ATTEMPT

PIN CODE

USERNAME AND PASSWORD

USERNAME AND PASSWORD

VERIFCATION

USIM CARD AUTHENTICATION

USIM CARD NUMBER

USIM NUMBER
VERIFICATION

IMAGE AUTHENTICATION
FACE IMAGE

FACE IMAGE
VERIFICATION

3-FACTOR AUTHENTICATION VERIFIED

PAY BILL
BILL DETAILS

COLLABRATION DIAGRAM

TRANSACTION SAVED

CLIENT
MOBILE
1: CONNECTING USING WIFI
3: LOGIN ATTEMPT
5: USERNAME AND PASSWORD
9: USIM CARD NUMBER
13: FACE IMAGE
17: PAY BILL

2: CONNECTION MADE
4: PIN CODE
8: USIM CARD AUTHENTICATION
12: IMAGE AUTHENTICATION

7: VERIFCATION
11: VERIFICATION
15: VERIFICATION
19: TRANSACTION SAVED
6: USERNAME AND PASSWORD
10: USIM NUMBER
14: FACE IMAGE
18: BILL DETAILS

BILLING DEVICE
16: 3-FACTOR AUTHENTICATION VERIFIED

ACTIVITY DIAGRAM

DATABASE

CLIENT
MOBILE

PAYING
DEVICE

CONNECTION
USING WIFI

LOGIN
ATTEMPT
PIN CODE
AUTHENTICATION

USIM
AUTHENTICATION

FACE IMAGE
AUTHENTICATION

3 FACTOR
VERIFICATION

BILL PAYMENT

SOFTWARE SPECIFICATION

ANDROID
World is contracting with the growth of mobile phone technology. As the number of users
is increasing day by day, facilities are also increasing. Starting with simple regular handsets
which were used just for making phone calls, mobiles have changed our lives and have become
part of it. Now they are not used just for making calls but they have innumerable uses and can be
used as a Camera , Music player, Tablet PC, T.V. , Web browser etc . And with the new
technologies, new software and operating systems are required.

What is Android
Operating Systems have developed a lot in last 15 years. Starting from black and white
phones to recent smart phones or mini computers, mobile OS has come far away. Especially for
smart phones, Mobile OS has greatly evolved from Palm OS in 1996 to Windows pocket PC in
2000 then to Blackberry OS and Android.
One of the most widely used mobile OS these days is ANDROID. Android is a software
bunch comprising not only operating system but also middleware and key applications. Android
Inc was founded in Palo Alto of California, U.S. by Andy Rubin, Rich miner, Nick sears and
Chris White in 2003. Later Android Inc. was acquired by Google in 2005. After original release
there have been number of updates in the original version of Android.

FEATURES & SPECIFICATIONS


Android is a powerful Operating System supporting a large number of applications in
Smart Phones. These applications make life more comfortable and advanced for the users.
Hardwares that support Android are mainly based on ARM architecture platform. Some of the
current features and specifications of android are:

Android comes with an Android market which is an online software store. It was
developed by Google. It allows Android users to select, and download applications developed by
third party developers and use them. There are around 2.0 lack+ games, application and widgets
available on the market for users.
Android applications are written in java programming language. Android is available as
open source for developers to develop applications which can be further used for selling in
android market. There are around 200000 applications developed for android with over 3
billion+ downloads. Android relies on Linux version 2.6 for core system services such as
security, memory management, process management, network stack, and driver model. For
software development, Android provides Android SDK (Software development kit). Read more
about open source software.

APPLICATIONS
These are the basics of Android applications:

Android applications are composed of one or more application components (activities,

services, content providers, and broadcast receivers)

Each component performs a different role in the overall application behavior, and each one

can be activated individually (even by other applications)

The manifest file must declare all components in the application and should also declare all

application requirements, such as the minimum version of Android required and any hardware
configurations required

Non-code application resources (images, strings, layout files, etc.) should include

alternatives for different device configurations (such as different strings for different languages)
Google, for software development and application development, had launched two
competitions ADC1 and ADC2 for the most innovative applications for Android. It offered prizes
of USD 10 million combined in ADC1 and 2. ADC1 was launched in January 2008 and ADC 2
was launched in May 2009. These competitions helped Google a lot in making Android better,
more user friendly, advanced and interactive
OTHER MOBILE OPERATING SYSTEMS
There are different other Mobile operating systems also present in market in competition
with Android. Apple's iOS and Windows Phone give strong competition to Android. A simple
comparison between features and specifications of latest version of Android and other Operating
Systems can be seen in the table given below.

According to Canalys, In Q2 2009 Android had 2.8% market share which had grown to
33% market share by Q4 2010 which made Android leader of smart phone OSs worldwide. The
market share for commonly used mobile OSs is shown in the following pie chart.

A large no of mobile companies are using Android. A list of companies supporting Android in
their hardware is:

Acer Inc

Lenovo

ALCATEL ( TCL corporation )

Bluelans Communications

NCE casio Mobile Communications

Cherry Mobile

HKC

Huawei

HTC corporation

LG

Samsung

I-mobile

High screen

Sony Ericsson

Videocon

ZTE

Dell

CSL

Motorola

ANDROID'S LATEST
Android is still updating. The recent version of Android (Honey comb 3.1) has very
advanced features and updated applications which are optimized for use on larger screen devices.
These applications are mentioned below:
Browser: Android's new version includes a number of new features for simple, fast and
convenient browsing with the Quick UI controls. It also supports popular web standards like CSS
3D, Animations and CSS fixed positioning to all sites, mobile or desktop. It also supports

playback of HTML5 video content. To make it better and convenient to manage favorite content,
users can now save a web page locally for offline viewing, including all styling and images.
A CLIP OF NEW BROWSER

Gallery: Now the new gallery supports PTP (Picture Transfer Protocol) so that users can
directly connect their cameras with Android device and transfer pictures with a single touch.
Calendar: Calendar grids are larger, for better readability and more accurate touchtargeting. Additionally, users can create a larger viewing area for grids by hiding the calendar list
controls. Controls in the date picker are redesigned, making them easier to see and use.
Contacts: The Contacts app now lets you locate contacts more easily using full text
search. Search returns matching results from all fields that are stored for a contact.
Email: When replying or forwarding an HTML message, The Email app now sends both
plain text and HTML bodies as a multi-part mime message. This ensures that the message will be
formatted properly for all recipients. Folder prefixes for IMAP accounts are now easier to define
and manage. To conserve battery power and minimize cell data usage, the application now
prefetches email from the server only when the device is connected to a Wi-Fi access point.
An updated Home screen widget give users quick access to more email. Users can touch
Email icon at the top of the widget to cycle through labels such as Inbox, Unread, and Starred.
The widget itself is now resizable, both horizontally and vertically.
Enterprise support: Users can now configure an HTTP proxy for each connected Wi-Fi
access point. This lets administrators work with users to set a proxy hostname, port, and any
bypass sub domains. This proxy configuration is automatically used by the Browser when the
Wi-Fi access point is connected, and may optionally be used by other apps. The proxy and IP
configuration is now backed up and restored across system updates and resets.

For developers, Androids new version has extended possibilities with new capabilities
that developers can build on to create new and powerful applications for tablets and smart
phones. Some of the new features for developers are:

Open Accessory API for rich interaction with peripherals

USB Host API

Input from mice, Joystick and game pad

Resizable home screen widgets

MTP (Media transfer protocol) ATI for integrating with external cameras

Real Time Transport protocol (RTP) ATI for control over audio streaming sessions.
With all these new features Android 3.1 is making life more comfortable and advanced.

Now with advanced browser, gallery, calendar, USB support, new hardwares supporting this OS
are pretty convenient.
Cell phones have really evolved earlier features like camera and music player but now
latest hardwares not only support such features but advanced use of such features as well as Bar
code scanner, text scanner etc which has made life better and simpler and Android has played an
instrumental role in this evolution with thousands of applications available in Android market
and open chance for developers to make it more advanced and better. In a way Android has
changed its users' life completely.
ANDROID EMULATOR
The Android SDK includes a virtual mobile device emulator that runs on your computer.
The emulator lets you prototype, develop and test Android applications without using a physical
device.
The Android emulator mimics all of the hardware and software features of a typical
mobile device, except that it cannot place actual phone calls. It provides a variety of navigation
and control keys, which you can "press" using your mouse or keyboard to generate events for
your application. It also provides a screen in which your application is displayed, together with
any other active Android applications.

To let you model and test your application more easily, the emulator utilizes Android
Virtual Device (AVD) configurations. AVDs let you define certain hardware aspects of your
emulated phone and allow you to create many configurations to test many Android platforms and
hardware permutations. Once your application is running on the emulator, it can use the services
of the Android platform to invoke other applications, access the network, play audio and video,
store and retrieve data, notify the user, and render graphical transitions and themes.
The emulator also includes a variety of debug capabilities, such as a console from which
you can log kernel output, simulate application interrupts (such as arriving SMS messages or
phone calls), and simulate latency effects and dropouts on the data network.

OVERVIEW
The Android emulator is an application that provides a virtual mobile device on which
you can run your Android applications. It runs a full Android system stack, down to the kernel
level, that includes a set of preinstalled applications (such as the dialer) that you can access from
your applications. You can choose what version of the Android system you want to run in the
emulator by configuring AVDs, and you can also customize the mobile device skin and key
mappings. When launching the emulator and at runtime, you can use a variety of commands and
options to control its behavior.

The Android system images available through the Android SDK Manager contain code
for the Android Linux kernel, the native libraries, the Dalvik VM, and the various Android
packages (such as the Android framework and preinstalled applications). The emulator provides
dynamic binary translation of device machine code to the OS and processor architecture of your
development machine.
The Android emulator supports many hardware features likely to be found on mobile
devices, including:

An ARMv5 CPU and the corresponding memory-management unit (MMU)

A 16-bit LCD display

One or more keyboards (a Qwerty-based keyboard and associated Dpad/Phone buttons)

A sound chip with output and input capabilities

Flash memory partitions (emulated through disk image files on the development
machine)

A GSM modem, including a simulated SIM Card

A camera, using a webcam connected to your development computer.

Sensors like an accelerometer, using data from a USB-connected Android device.


The following sections describe the emulator and its use for development of Android
applications in more detail.
ANDROID VIRTUAL DEVICES AND THE EMULATOR
To use the emulator, you first must create one or more AVD configurations. In each
configuration, you specify an Android platform to run in the emulator and the set of hardware
options and emulator skin you want to use. Then, when you launch the emulator, you specify the
AVD configuration that you want to load.
Each AVD functions as an independent device, with its own private storage for user data,
SD card, and so on. When you launch the emulator with an AVD configuration, it automatically

loads the user data and SD card data from the AVD directory. By default, the emulator stores the
user data, SD card data, and cache in the AVD directory.
To create and manage AVDs you use the AVD Manager UI or the android tool that is
included in the SDK. For complete information about how to set up AVDs, see Managing Virtual
Devices.

CODING:
LOGIN ACTIVITY
package com.example.paymentclient;
import java.io.IOException;
import com.example.paymentclient.MainActivity.ClientThread;
import packet.PacType;
import packet.Packet;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class LoginActivity extends Activity {


Context con;
private Handler handler = new Handler(){
@Override
public void handleMessage(Message message){
switch (message.arg1) {
case 0:
Toast.makeText(Main,
Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

message.obj.toString(),

setContentView(R.layout.login);
Intilize();
}

Button BtnSubmit,BtnReg;
Context Main;
TextView TxtUsername,TxtPass;
String UserName, Pass;

void Intilize()
{
Main = this;
TxtUsername = (TextView) this.findViewById (R.id.ETUserName);
TxtPass = (TextView) this.findViewById (R.id.Etpassword);
BtnSubmit = (Button)this.findViewById (R.id.btnLogin);
BtnSubmit_Listenerr();
}

void BtnSubmit_Listenerr()
{
BtnSubmit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
UserName = TxtUsername.getText().toString();
Pass = TxtPass.getText().toString();
Thread cThread = new Thread(new ClientThread());

cThread.start();
}
});
}
public class ClientThread implements Runnable {
public void run() {
Packet pac = new Packet();
pac.Type = PacType.Login;
pac.UserName=UserName;
pac.Password = Pass;
try {
pac = TCPClient.Send(pac);
if(Boolean.valueOf(pac.Result.toString()))
{
Intent intent = new Intent(getApplicationContext() ,
PinActivity.class);
startActivity(intent);
}
else
{
handler.sendMessage(Message.obtain(handler,0,0,0,"Invalid UserName and Password"));
}
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}

}
}
}
PAYMENT ACTIVITY
package com.example.paymentclient;
import java.io.IOException;
import com.example.paymentclient.PinActivity.ClientThread;
import packet.PacType;
import packet.Packet;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class paymentactivity extends Activity {
Button BtnPay;
EditText ETBName, ETBranch,ETAccNumber,ETAmt;
String Bname="", BBranch="",BAccNum="";
Context con;

private Handler handler = new Handler(){


@Override
public void handleMessage(Message message){
switch (message.arg1) {
case 0:
Toast.makeText(con,

message.obj.toString(),

Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.payment);
Init();
}
void Init()
{
con = this;
ETBName = (EditText)this.findViewById(R.id.ETBName);
ETBranch = (EditText)this.findViewById(R.id.ETBBranch);
ETAccNumber = (EditText)this.findViewById(R.id.ETAccNumber);
ETAmt = (EditText)this.findViewById(R.id.ETPayAmount);
Bundle extras = getIntent().getExtras();

if(extras != null)
ETAmt.setText(extras.getString("Amt"));
BtnPay = (Button)this.findViewById(R.id.BTPay);
BtnPay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Bname = ETBName.getText().toString();
BBranch = ETBranch.getText().toString();
BAccNum = ETAccNumber.getText().toString();
Thread cThread = new Thread(new ClientThread());
cThread.start();
}
});
}
public class ClientThread implements Runnable {
public void run() {
Packet pac = new Packet();
pac.Type = PacType.Query;
pac.UserName= Bname;
pac.Password = BBranch;
pac.Query = BAccNum;
try {
pac = TCPClient.Send(pac);
if(Boolean.valueOf(pac.Result.toString()))
{
handler.sendMessage(Message.obtain(handler,0,0,0,"Paid
successfull!"));

Intent intent = new Intent(getApplicationContext() ,


LoginActivity.class);
startActivity(intent);
}
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
}
IMAGE AUTHENTICATION
package com.example.paymentclient;
import java.io.IOException;
import com.example.paymentclient.LoginActivity.ClientThread;
import packet.PacType;
import packet.Packet;
import android.R.string;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
public class imageauth extends Activity {
private static int RESULT_LOAD_IMAGE = 1;
private Bitmap ImgAuth= null;
ImageView imageView = null;
String imgurl = "";
Context con;
private Handler handler = new Handler(){
@Override
public void handleMessage(Message message){
switch (message.arg1) {
case 0:
Toast.makeText(con,
Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}

message.obj.toString(),

};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.imageauth);
con = this;
Init();
}
void Init()
{
imageView = (ImageView) findViewById(R.id.imageView1);
Button buttonLoadImage = (Button) findViewById(R.id.BtnImgGal);
buttonLoadImage.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent

new

Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTE
NT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
}
});
Button ButtonSend = (Button) findViewById(R.id.BtnImgSend);
ButtonSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Thread cThread = new Thread(new ClientThread());
cThread.start();
}

});
}
public class ClientThread implements Runnable {
public void run() {
Packet pac = new Packet();
pac.Type = PacType.Get_Tables;
pac.Result = String.valueOf(ImgAuth.getPixel(55, 55));
pac.UserName = String.valueOf(ImgAuth.getPixel(11, 22));
pac.Password = String.valueOf(ImgAuth.getPixel(29, 33));

try {
pac = TCPClient.Send(pac);
if(Boolean.valueOf(pac.Result.toString()))
{
Intent intent = new Intent(getApplicationContext() ,
paymentactivity.class);
intent.putExtra("Amt", pac.Query);
startActivity(intent);
}
else
{
Intent intent = new Intent(getApplicationContext() ,
LoginActivity.class);
intent.putExtra("Amt", pac.Query);
startActivity(intent);
handler.sendMessage(Message.obtain(handler,0,0,0,"Invalid Image"));
}

} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try{
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null !=
data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null,
null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
imgurl = cursor.getString(columnIndex);
cursor.close();
ImgAuth = BitmapFactory.decodeFile(imgurl);
imageView.setImageBitmap(ImgAuth);
/*
imageView.setDrawingCacheEnabled(true);

imageView.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
imageView.layout(0,

0,

imageView.getMeasuredWidth(),

imageView.getMeasuredHeight());
imageView.buildDrawingCache(true);
ImgAuth = Bitmap.createBitmap(imageView.getDrawingCache());
imageView.setDrawingCacheEnabled(false);
*/
}
}
catch (Exception e) {
// TODO: handle exception
Toast.makeText(imageauth.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
ADDUSER
package com.example.paymentserver;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import android.widget.EditText;
import android.widget.Toast;

public class adduseractivity extends Activity {


EditText ETName,ETUName,ETPass,ETEmail,ETImei,ETamt,ETimg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.adduser);
Bundle extras = getIntent().getExtras();

ETName = (EditText)findViewById(R.id.ETName);
ETUName = (EditText)findViewById(R.id.ETUName);
ETPass = (EditText)findViewById(R.id.ETPass);
ETEmail = (EditText)findViewById(R.id.ETEmail);
ETImei = (EditText)findViewById(R.id.ETImei);
ETamt = (EditText)findViewById(R.id.ETAmt);
ETimg = (EditText)findViewById(R.id.ETImg);
if(extras != null)
{
ETName.setText(extras.getString("name"));
ETUName.setText(extras.getString("uname"));
ETPass.setText(extras.getString("pass"));
ETEmail.setText(extras.getString("email"));
ETImei.setText(extras.getString("imei"));

ETamt.setText(extras.getString("amount"));
ETimg.setText(extras.getString("url"));
}
Init();
}
void Init()
{
Button BtnBrw = (Button)findViewById(R.id.Btnbrw);
BtnBrw.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent

new

Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTE
NT_URI);
startActivityForResult(i, 1);
}
});
Button btnRegisButton = (Button)findViewById(R.id.BtnRegister);
btnRegisButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub

User
ETUName.getText().toString(),

usr

new

User(ETName.getText().toString(),

ETPass.getText().toString(),

ETEmail.getText().toString(),

ETImei.getText().toString(), ETimg.getText().toString(), ETamt.getText().toString());


DatabaseHandler db = new DatabaseHandler(adduseractivity.this);
if(!db.CheckUser(ETUName.getText().toString()))
{
db.addPlan(usr);
Intent

myIntent

new

Intent(adduseractivity.this,

MainActivity.class);
startActivity(myIntent);
finish();
}
else
{
Toast.makeText(adduseractivity.this, "This User Name
Already Exists", Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };

Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null,


null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
ETimg.setText(picturePath);
}
}

FUTURE SCOPE:
In the near future, more multi-factor authentication features and virtual private networking
features will keep being developed and integrated.
CONCLUSION:
In this project, the Android-based mobile payment service can perform well and securely
using 3 factor authentications like pin code, usim number, face image authentication.

REFERENCES:

[1] A. Pentland, B. Moghaddam, and T. Starner, Face Recognition using View-Based and

Modular Eigenspaces, Proceedings of IEEE Computer Society Conference on Computer Vision


and Pattern Recognition, pp. 8491, Jun. 1994.
[2] L. Wiskott, J. M. Fellous, N. Kuiger, and C. von der Malsburg, Face recognition by elastic
bunch graph matching, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol.
19, pp. 775779, Jul. 1997.
[3] V. Blanz and T. Vetter, Face recognition based on fitting a 3D morphable model, IEEE
Transactions on Pattern Analysis and Machine Intelligence, vol. 25, pp. 16031074, Sep. 2003.

[4] A. Lanitis, C. J. Taylor, and T. F. Cootes, Automatic interpretation and coding of face images
using flexible models, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 19,
pp. 743756, Jul. 1997.
[5] S. Baker, I. Matthews, and J. Schneider, Automatic construction of active appearance
models as an image coding problem, IEEE Transactions on Pattern Analysis and Machine
Intelligence, vol. 26, pp. 13801384, Oct. 2004.
[6] X. Chai; S. Shan, and W. Gao, Pose normalization for robust face recognition based on
statistical affine transformation, Proceedings of IEEE International Conference on Information,
Communications and Signal Processing, vol. 3, pp. 14131417, Dec. 2003.
[7] Y. Gao, M. K. H. Leung, W. Wang, and S. C. Hui, Fast face identification under varying
pose from a single 2-D model view, IEE Proceedings of Vision, Image and Signal Processing,
vol. 148, pp. 248253, Aug. 2001.
[8] Google, Android Developers, [Online]. Available: http://developer.android.com/index.html

Вам также может понравиться