Sie sind auf Seite 1von 64

LAB MANAGEMENT SYSTEM

A PROJECT REPORT

Submitted by

M.MULLAIRAJA (Register No:080123510)

P.NIRMALRAJ (Register No:08012351060)

V.RAJAIAH (Register No:08012351074)

S.SENTHILNATHAN (Register No:08012351092)

Of

MASTER OF SCIENCE IN SOFTWARE ENGINEERING

PERIYAR MANIAMAI UNIVERSITY

VALLAM

APRIL 2011
BONFIDE CERTIFICATE

Certified that the Bonafide record of work done by

Selvi. / Selvan. / …………………………………. Reg. No…………………

in …………………………….of the “Periyar Maniammai University,

Vallam” during the year 200 - 20 .

Signature of the Lab Incharge Signature of the Head of Dept.

Submitted to Periyar Maniammai University Practical Examination

held on………………………….. .

Internal Examiner External Examiner


\ ACKNOWLEDGEMENT

It is the sincere feeling of respect to express gratitude to our esteemed

Institution, PERIYAR MANIAMMAI UNIVERSITY , which has given

us an opportunity to fulfill our objective. We register our sincere gratitude

to our chairman professor N.RAMACHANDRAN for his blessings and

support

to carry out this project.

We consider it as a great pleasure, to extend our heartfelt gratitude to our

Principal Mr.NITHYANANDHAM, M.sc., M.Phil., M.Tech., for his

Encouragement.

We are highly indebted to our Head Of the Department

Mrs.NALAYINI, M.E., for her wholehearted support and encouragement to

Complete this project successfully.

We are grateful to the project guide Miss.ABIRAMI B.E., for her

acceptance in guiding us to complete this project.

My heart goes all in gratitude to our family and friends who encouraged

and helped us in numerous ways. With regards and respect I bestow

the success of this project to all of them.


TABLE OF CONTENTS

CHAPTER NO TITLE PAGE NO

ABSTRACT i
LIST OF TABLES ii
LIST OF FIGURES iii
LIST OF ABBREVIATIONS iii

1 OUTLINE OF THE PROJECT 1

2 LITERATURE REVIEW 2
2.1 EXISTING SYSTEM 3
2.2 PROPOSED SYSTEM 4
2.3 SCOPE OF THE PROJECT 5

3 SYSTEM REQUIREMENT SPECIFICATION 10


3.1 SOFTWARE REQUIREMENT 10
3.2 HARDWARE REQUIREMENT 10
3.3 ABOUT THE SOFTWARE 11

4 PROJECT SPECIFICATION 21
4.1 MODULE DESCRIPTION
4.2 REGISTRATION DETAILS 28
4.3 SCREENING DETAILS 29
4.4 MODIFY DETAILS 29
4.5 TRUNCATE DETAILS 29

5 DESIGN SPECIFICATION 30
5.1 TABLES 30
5.2 SYSTEM FLOW DIAGRAM 32
5.3 DATA FLOW DIAGRAM 33

6 IMPLEMENTATION 34
6.1 SAMPLE CODING

7 SAMPLE OUTPUT 48

8 CONCLUSION 60

9 BIBLIOGRAPHY 61
ABSTRACT:

Lab management system is a system that will be developed


by enhanced the monitoring the system for computer labs.
The purpose of development of the projects to increases efficiency and
security of the computer labs.
However currently who log on to the computer need to write the purpose of
using the computer.
Hence the application will be built when the students can their purpose at the
same time entering the username and password before logging on to the
windows.
These data will be stored in the database where it will be viewed by the
administrator and another features added in a subsystem that will be monitor
the department timetable and hardware and software requirements of the
computer lab.
LIST OF TABLES

1. LOGIN
2.
3. USER INFO

LIST OF FIGURES:
iii

CHAPTER 1
OUTLINE OF THE PROJECT:
RADIO Frequency Identification (RFID) tags for the function of next-
generation electronic product code (EPC) will become one of the most
widely used devices in the near future. An RFID application contains three
basic roles:
1. Tag,
2. Reader,
3. Back-end database.
Each tag contains a unique identification, often called the tag identification
(TID). The reader is used to query the tag’s TID and forward it to the back-
end database. Once the tag is found valid, the back-end database will look up
its product information for further processing. RFID tags are classified into
three types: active, semipassive, and passive. Active tags contain batteries so
that they can actively communicate with the reader. Semipassive tags also
contain batteries but they wait for the reader’s query. As for passive tags, the
power comes from the reader. The class of a tag represents the effective
reading range. The reading range of a class-0 tag is 5-10 cm, and that of a
class-1 tag is up to several meters.

CHAPTER 2
LITERATURE REVIEW
EXISTING SYSTEM:

Recently, as low-cost radio frequency identification (RFID)


becomes more pervasive in our daily lives, RFID systems may create new
threats to security and privacy of individuals and organizations. It must have
secure mutual authentication mechanisms to protect privacy information.
However, the previous works on designing security protocols for RFID
either do not conform to the EPCglobal Class 1 Generation 2 (GEN-2)
standards or suffer from security flaws.
2

PROPOSED SYSTEM:

Our main idea is to randomize each session and provide mutual


authentication between legitimate readers and tags, like other pseudonym-
based approaches . We assume that each tag shares an l-word-long random
string, called key pool, with the back-end database.
The string is considered as a key pool where we can randomly
draw keys. A threshold value is set in each tag to tolerate error bits of the
received value and to boost the reading speed. Therefore, we need an extra
circuitry element in the tag to calculate the Hamming distance of two 16-bit
numbers.
We proposed a mutual authentication protocol for RFID
systems to improve the previous schemes. However, their scheme cannot
efficiently retrieve the information of tags from its database for the
authentication. To guarantee the quality of the growing popular
communication services, it is urgent to construct efficient authentication for
both parties of the tag and the back-end server such that the reader can
quickly obtain the information of tag from its database.
For light-weight calculation power of a tag and protecting the privacy
of user (or product), this article proposes the RFID mutual authentication
scheme based on GEN-2 standards. The proposed scheme can efficiently
retrieve the information of tags from the database in the authentication
process. Moreover, the proposed scheme can improve the previous schemes
and provide anonymous property and forward secrecy.
3

SCOPE OF THE PROJECT:

Several solutions have been proposed based on


traditional encryption methods, such as symmetric or asymmetric ciphers,
but they are not suitable for low-cost RFID tags. Recently, some lightweight
authentication protocols conforming to Gen2 have been proposed. However,
the message flow of these protocols is different from Gen2.

Existing readers may fail to read new tags. In this paper, we propose a
novel authentication protocol based on Gen2, called Gen2^ {+}, for low-cost
RFID tags. Our protocol follows every message flow in Gen2 to provide
backward compatibility. Gen2^ {+} is a multiple round protocol using
shared pseudonyms and Cyclic Redundancy Check (CRC) to achieve reader-
to-tag authentication.

Conversely, Gen2^ {+} uses the memory read command defined in


Gen2 to achieve tag-to-reader authentication. We show that Gen2^ {+} is
more secure under tracing and cloning attacks.

CHAPTER 3
SYSTEM REQUIREMENT SPECIFICATION

SOFTWARE REQUIREMENTS:

Front End Tool:


• ASP.Net 2005 (C#)
Back End Tool:
• SQL Server 2005

HARDWARE REQUIREMENTS:
Processor : Intel Pentium IV @ 3.0GHz

Hard Disk : 80GB

Main Memory : 512MB

Visual Display Unit : SVGA Color monitor.

Keyboard : 108keys.

Mouse : Optical mouse

ABOUT THE SOFTWARE

FEATURES OF .NET:
Microsoft .NET is a set of Microsoft software technologies for
rapidly building and integrating XML Web services, Microsoft Windows-
based applications, and Web solutions. The .NET Framework is a language-
neutral platform for writing programs that can easily and securely
interoperate. There’s no language barrier with .NET: there are numerous
languages available to the developer including Managed C++, C#, Visual
Basic and Java Script. The .NET framework provides the foundation for
components to interact seamlessly, whether locally or remotely on different
platforms. It standardizes common data types and communications protocols
so that components created in different languages can easily interoperate.
“.NET” is also the collective name given to various software
components built upon the .NET platform. These will be both products
(Visual Studio.NET and Windows.NET Server, for instance) and services
(like Passport, .NET My Services, and so on).

THE .NET FRAMEWORK


The .NET Framework has two main parts:
1. The Common Language Runtime (CLR).
2. A hierarchical set of class libraries.

THE COMMON LANGUAGE RUNTIME:

The CLR is described as the “execution engine” of .NET. It provides the


environment within which programs run. The most important features are

♦ Conversion from a low-level assembler-style language, called


Intermediate Language (IL), into code native to the platform
being executed on.
♦ Memory management, notably including garbage collection.
♦ Checking and enforcing security restrictions on the running
code.
♦ Loading and executing programs, with version control and
other such features.
♦ The following features of the .NET framework are also worth
description:

MANAGED CODE
The code that targets .NET, and which contains certain extra
Information - “metadata” - to describe itself. Whilst both managed and
unmanaged code can run in the runtime, only managed code contains the
information that allows the CLR to guarantee, for instance, safe execution
and interoperability.

MANAGED DATA
With Managed Code comes Managed Data. CLR provides
memory allocation and Deal location facilities, and garbage collection. Some
.NET languages use Managed Data by default, such as C#, Visual
Basic.NET and JScript.NET, whereas others, namely C++, do not. Targeting
CLR can, depending on the language you’re using, impose certain
constraints on the features available. As with managed and unmanaged code,
one can have both managed and unmanaged data in .NET applications - data
that doesn’t get garbage collected but instead is looked after by unmanaged
code.
COMMON TYPE SYSTEM

The CLR uses something called the Common Type System (CTS) to
strictly enforce type-safety. This ensures that all classes are compatible with
each other, by describing types in a common way. CTS define how types
work within the runtime, which enables types in one language to
interoperate with types in another language, including cross-language
exception handling. As well as ensuring that types are only used in
appropriate ways, the runtime also ensures that code doesn’t attempt to
access memory that hasn’t been allocated to it.

COMMON LANGUAGE SPECIFICATION


The CLR provides built-in support for language interoperability. To
ensure that you can develop managed code that can be fully used by
developers using any programming language, a set of language features and
rules for using them called the Common Language Specification (CLS) has
been defined. Components that follow these rules and expose only CLS
features are considered CLS-compliant.
THE CLASS LIBRARY
.NET provides a single-rooted hierarchy of classes, containing
over 7000 types. The root of the namespace is called System; this contains
basic types like Byte, Double, Boolean, and String, as well as Object. All
objects derive from System. Object. As well as objects, there are value
types. Value types can be allocated on the stack, which can provide useful
flexibility. There are also efficient means of converting value types to object
types if and when necessary.
The set of classes is pretty comprehensive, providing
collections, file, screen, and network I/O, threading, and so on, as well as
XML and database connectivity.
The class library is subdivided into a number of sets (or
namespaces), each providing distinct areas of functionality, with
dependencies between the namespaces kept to a minimum.

9
LANGUAGES SUPPORTED BY .NET
The multi-language capability of the .NET Framework and
Visual Studio .NET enables developers to use their existing programming
skills to build all types of applications and XML Web services. The .NET
framework supports new versions of Microsoft’s old favorites Visual Basic
and C++ (as VB.NET and Managed C++), but there are also a number of
new additions to the family.

Visual Basic .NET has been updated to include many new and
improved language features that make it a powerful object-oriented
programming language. These features include inheritance, interfaces, and
overloading, among others. Visual Basic also now supports structured
exception handling, custom attributes and also supports multi-threading.

Visual Basic .NET is also CLS compliant, which means that


any CLS-compliant language can use the classes, objects, and components
you create in Visual Basic .NET.

Managed Extensions for C++ and attributed programming are


just some of the enhancements made to the C++ language. Managed
Extensions simplify the task of migrating existing C++ applications to the
new .NET Framework.

C# is Microsoft’s new language. It’s a C-style language that is


essentially “C++ for Rapid Application Development”. Unlike other
languages, its specification is just the grammar of the language. It has no
standard library of its own, and instead has been designed with the intention
of using the .NET libraries as its own.
Microsoft Visual J# .NET provides the easiest transition for
Java-language developers into the world of XML Web Services and
dramatically improves the interoperability of Java-language programs with
existing software written in a variety of other programming languages.
Active State has created Visual Perl and Visual Python, which
enable .NET-aware applications to be built in either Perl or Python. Both
products can be integrated into the Visual Studio .NET environment. Visual
Perl includes support for Active State’s Perl Dev Kit.
Other languages for which .NET compilers are available include
• FORTRAN
• COBOL
• EIFFEL

16

Fig 1.Net Framework

ASP.NET Windows

XML WEB Forms

SERVICES
Base Class Libraries C#.NET is
Common Language Runtime
Operating System also
compliant with CLS (Common Language Specification) and supports
structured exception handling. CLS is set of rules and constructs that are
supported by the CLR (Common Language Runtime). CLR is the runtime
environment provided by the .NET Framework; it manages the execution of
the code and also makes the development process easier by providing
services.
C#.NET is a CLS-compliant language. Any objects, classes, or
components that created in C#.NET can be used in any other CLS-compliant
language. In addition, we can use objects, classes, and components created
in other CLS-compliant languages in C#.NET .The use of CLS ensures
complete interoperability among applications, regardless of the languages
used to create the application.
17

CONSTRUCTORS AND DESTRUCTORS:

Constructors are used to initialize objects, whereas destructors are


used to destroy them. In other words, destructors are used to release the
resources allocated to the object. In C#.NET the sub finalize procedure is
available. The sub finalize procedure is used to complete the tasks that must
be performed when an object is destroyed. The sub finalize procedure is
called automatically when an object is destroyed. In addition, the sub
finalize procedure can be called only from the class it belongs to or from
derived classes.

GARBAGE COLLECTION

Garbage Collection is another new feature in C#.NET. The .NET


Framework monitors allocated resources, such as objects and variables. In
addition, the .NET Framework automatically releases memory for reuse by
destroying objects that are no longer in use.

In C#.NET, the garbage collector checks for the objects that are not
currently in use by applications. When the garbage collector comes across an
object that is marked for garbage collection, it releases the memory occupied
by the object.

18

OVERLOADING

Overloading is another feature in C#. Overloading enables us to


define multiple procedures with the same name, where each procedure
has a different set of arguments. Besides using overloading for
procedures, we can use it for constructors and properties in a class.

MULTITHREADING

C#.NET also supports multithreading. An application that supports


multithreading can handle multiple tasks simultaneously, we can use
multithreading to decrease the time taken by an application to respond to
user interaction.

STRUCTURED EXCEPTION HANDLING


C#.NET supports structured handling, which enables us to
detect and remove errors at runtime. In C#.NET, we need to use Try…
Catch…Finally statements to create exception handlers. Using Try…
Catch…Finally statements, we can create robust and effective exception
handlers to improve the performance of our application.

19

THE .NET FRAMEWORK

The .NET Framework is a new computing platform that simplifies


application development in the highly distributed environment of the
Internet.

OBJECTIVES OF . NET FRAMEWORK

1. To provide a consistent object-oriented programming environment


whether object codes is stored and executed locally on Internet-
distributed, or executed remotely.

2. To provide a code-execution environment to minimizes software


deployment and guarantees safe execution of code.

3. Eliminates the performance problems.


There are different types of application, such as Windows-based
applications and Web-based applications.

20

CHAPTER 4

PROJECT SPECIFICATITON
MODULE DESCRIPTION

This Project having five major Modules named as follows


 File
 User Authentication
 RFID Authentication
 Registration details
 Admin
 User
 Screening
 Admin
 User

 Modify Details
 Admin
 User
 Truncate Details
 Admin
 User

21

File
User Authentication
Authentication is the process of determining the authenticity of a user
based on the user’s credentials. Whenever a user logs on to an application,
the user is first authenticated and then authorized. It is the job of the
authentication provider to verify the credentials of the user and decide
whether a particular request should be considered authenticated or not.

RFID Authentication
The benefits of RFID compared to old authentication technologies
include non line-of-sight reading, item-level identification, non-static nature
of security features, and cryptographic resistance against cloning. RFID
systems in general comprise transponders, readers or interrogators, and
online database, sometimes referred to as the back-end server. The potential
of RFID in anti-counterfeiting is discussed further in [9] and [10]. There are
many applications where RFID transponders are already used for
authentication, for example access control. While RFID product
authentication is very close to RFID access control what comes to the used
authentication protocols, product authentication needs specific solutions
because of the specific application requirements discussed in the previous
section.

22

RFID product authentication can be based on transponder


authentication or identification and additional reasoning using online
product data. Furthermore, RFID supports for secure ways to bind the label
and the product. To resist cloning and forgery are the most important
security properties of authentication tags. The simplest cloning attack
against an RFID tag only requires reading the tag serial number and
programming the same number into an empty tag.

SECURED GEN2 PROTOCOL:

In the following, we show the basic version of the secured


Gen2 protocol.
23

Step 1 in Fig is the same as the simulation protocol described in the


specification. The reader sends commands Query/QueryAdjust/QueryRep to
select a specific tag.
In Step 2, the tag whose Q-slot counted down to zero responds to the
reader’s request and backscatters RN16 to proceed. We now consider this
16-bit random number as two 8-bit addresses, a and b. These two numbers
mark a segment of the keypool stored in this tag.
Let k½a : b_denote the segment (substring) from the ath word to the bth
word of keypool k. Note that this marking is made circular, which follows
the following equations. At the same time, the tag calculates the CRC
residue of k½a : b_ and keeps the residue, which is denoted by ck
In Step 2 of Fig. 2, the reader simply forwards this number to the back-
end database. The database then searches through records and generates a
16-bit number ck0, called the centralkey, in Step 3. This value is sent back
to
the reader and the tag as well.
In Step 4, the tag compares ck0 with ck. If their Hamming distance is
smaller than a threshold value t, the tag believes the reader is legal and
replies with its EPC data; otherwise, it remains silent and returns to arbitrate
state. Most of the time, only Steps 1-4 are required. We suggest updating
keypool through MemWrite command once in a while. Since the steps of
requesting PIN number and the steps of MemWrite command are exactly the
same as in the standard (Fig. 1), they are omitted here.

24

During the update, the back-end server randomly generates another l-


wordlong string as the new keypool and overwrites the old value
throughmemory write. Steps 1-4 only provide reader-to-tag authentication. If
the back-end server wants to check whether a tag is valid or not, it can read
out the whole keypool and check if it is the same in database. The threshold
value t is also configurable by using MemWrite command. This value
represents that the tag can tolerate up to t-bit Hamming distance between
ck0 and ck. This value is previously set to 16 before deployment, which
means the tag always accepts and acts like a Gen2 tag. The threshold value
is designed to boost the reading speed and provide a trade-off between
security and efficiency. After the tagged item is sold at the retail, t is set to
zero to prevent further active scanning. This means the tag only accepts if
ck0 exactly matches ck.
For example:
Let l ¼ 32, t ¼ 1, and
keypool ¼ 1234567890FFF . . .FFFh.
1. R ! T: Query.
2. T ! R: Choose ða; bÞ ¼ ð0; 4Þ.
Hence, the segment is k½a : b_ ¼ 1234567890h.
3. S ! R: Assume the back-end database calculates the
central key from the current database and obtains
ck0 ¼ 53D8h.
4. R ! T: ck0.
25

CENTRAL KEY:
Fig. 3 shows an example of the construction of centralkey.
First, perform CRC-16 computations on each keypool marked by ða; bÞ
within the database. After that, all drawn pseudonyms (16-bit strings) are
passed through a majority function in bitwise. A majority function outputs
“1” if its input contains more 1’s than 0’s; otherwise, it outputs “0.”
This can be realized by a counter.
The output of each bit position forms the final 16-bit ck0. The value
of ck0 has the minimalist Hamming distance in average with all these values
passed through CRC-16. Hence, the tag can check if ck0 is close enough to
its own computation. If there is only one record left in the database, ck0
should equal ck. If ck0 is not accepted, this means ck0 is not close enough to
the desired value, which means the size of the candidate set in the database
is still large.

26

CANDIDATE SET ALGORITHM:

Brute-force searching through database helps nothing if a and b


change every round. Here, we present a candidate set finding algorithm that
will produce a ck0 close enough to be accepted. After singulation processes,
the back-end database generates ck0 and lets the reader forward it to the tag.
Consider the target CRC value ck as a codeword in the code space of 216,
where t is the acceptable range of the tag. We want to find a suitable
codeword that falls into this range. If the tag does not respond, which means
ck0 is outside the range, we then eliminate some entries in the database.
Note that a and b changes every round and ck0 must be recomputed. The
following is a pseudocode of the candidate set finding algorithm for the
back-end database:

Algorithm 1. Candidate Set Finding Algorithm


CandidateSet S ¼ fk1; k2; k3; . . . kNg
// N is the size of database
While( true )
Do
Obtain (a; b)
ck0 ¼ GenCentralKey (S; a; b)
send ck0
If tag responds Then Exit
Else
For each entry ki in S
Delete if distance(ck0, CRC-16(ki½a:b_Þ _ t
Next
EndIf
Loop

27

The central key guarantees that on each position of the 16-bit string, there
exists at least N=2 records having the same bit, where N is the total number
of records in the backend database. If the distribution of CRC function is not
uniform, perhaps only less than N=3 of them have a mismatch. The
characteristic allows legal readers to quickly narrow down the candidate set.
We assume that pi is the probability of a CRC residue matching ck in the ith
bit, which is pi ¼ 1=2 þ _i. Let p be the average probability of pi. The
probability that the Hamming distance between ck0 and ck is less than or
equal to t, denoted as P00, is calculated by the following:
000 ¼X
t
j_0
16
j _ __ ð1 _ pÞj _ ðpÞ16_j: ð5Þ
The main idea of multiple rounds is that a legitimate reader can prune some
neighbor values of ck0 during each round and quickly narrow down the
space. At the first round, if ck0 is not accepted, then N _ P00 tags are
removed from the candidate set. Afterward, the size of the set shrinks to
N _ ð1 _ P00Þ, then N _ ð1 _ P00Þ2, and so forth. If the size of the
candidate set is less than or equal to 1, the database identifies the tag
successfully.
2. Registration Details:
2.1 Admin:
Add new data by admin for further processing (i.e.) Add
Administration details
Can admin do full process for this RFID.

28

2.2 User:
Add new user by admin for further processing (i.e.) Add end user
details
User can view only their information only.
3. Screening the Details:
3.1 Admin:
View the Administration Data(s) (i.e.) Administration details
Admin can view the process of RFID Process details.
3.2 User:
View the user data(s) (i.e.) user details
User can view only their information only.
4. Modify The Details:
4.1 Admin:
Logged in user can Modify their data’s (i.e.) changing the information
about him.
4.2 User:
User can also change their related data.
5. Truncate The Details:
5.1 Admin:
Admin can truncate the details
Can admin do full process for this RFID.
5.2 User:
User can also truncate the RFID Details without high loss.

29

CHAPTER 5
DESIGN SPECIFICATION
DATABASE TABLES:
DATABASE NAME: RFID
TABLE NAME: LOGIN

COLUMN NAME DATATYPE


Id int identity(4)
AdminsId varchar(20)
AdminsName varchar(30)
Uid varchar(30)
Pwd varchar(30)
MailId varchar(50)
Address varchar(500)

DATABASE NAME: RFID


TABLE NAME: PRODUCTS

COLUMN NAME DATATYPE


PID int identity(10)
PRFID text (2147483647)
ProductName varchar(150)
Ingredients varchar(250)
Remarks varchar(250)
Rate Decimal(10)
UID varchar(500)

30
DATABASE NAME: RFID
TABLE NAME: USERINFO
COLUMN NAME DATATYPE
Id int identity(4)
RFID varchar( 7999)
RF varchar( 7999)
EmpId varchar(20)
EmpName varchar(30)
Desig varchar(30)
Depart varchar(30)
DOJ varchar(20)
Experience varchar(30)
DOB varchar(20)
Address varchar(500)
City varchar(30)
Country varchar(30)
Pin varchar(10)

31
SYSTEM FLOW DIAGRAM :
RFID

LOGIN

USER DEISGN
VIEW DETAILS AUTHENTICATTION

ADMIN INFO
USER CREATION
USER INFO

ASSIGNING RFID

PRODUCTS

DAT
A FLOW DIAGRAMS:

Id
AdminsId
AdminsNam Proces New user creation
e
s
Uid
Pwd
MailId
Address

32
PID
PRFID
ProductNa
me Proces Entering Products
Ingredien s
ts
Remarks
Rate
UID

Id
RFID
RF
EmpId
EmpName
Desig Proces Authentication
Depart s
DOJ
Experianc
e
DOB
Address
City
Country
Pin

33
CHAPTER 6

IMPLEMENTATION:

SAMPLE CODING:

RFID LOGIN:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace RFID
{
public partial class Login : Form
{
Data_Access da = new Data_Access();
Home objHome = new Home();
public Login()
InitializeComponent();
Thread objThread = new Thread(new ThreadStart(DoSplash));
objThread.Start();
Thread.Sleep(3000);
objThread.Abort();
34
}
private void DoSplash()
{
WelcomeScreen splashScreen = new WelcomeScreen();
splashScreen.ShowDialog();
}
private void BtnLogin_Click(object sender, EventArgs e)
{
if (txtuname.Text.Length > 0 && txtpwd.Text.Length > 0)
{
da.DBReader("select * from Login where Uid='" + txtuname.Text + "'and
pwd='" + txtpwd.Text + "'");
if (da.dr.Read())
{
Home.log = "Login";
ProductEntry.userID = da.dr["AdminsID"].ToString();
da.DBReaderClose();
this.Hide();
objHome.Show();
}
else
{
MessageBox.Show("Invalid username or password", "Error!!!",
MessageBoxButtons.OK, MessageBoxIcon.Error);
txtuname.Focus();
}
35
else
{
MessageBox.Show("Enter username / Password", "Caution",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtuname.Focus();
}
}
private void BtnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
ENCRYPTION:
using System;
using System.Collections;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace RFID
{
public class EncryptionThread
private ContainerControl containerControl = null;
private Delegate updateTextDelegate = null;
public static string send;
public void Encrypt(object inputObject)
36
object[] inputObjects = (object[])inputObject;
containerControl = (Form)inputObjects[0];
updateTextDelegate = (Delegate)inputObjects[1];
string encryptedString = EncryptString((string)inputObjects[2],
(int)inputObjects[3], (string)inputObjects[4]);
containerControl.Invoke(updateTextDelegate, new object[]
{ encryptedString });
}
public string EncryptString(string inputString, int dwKeySize, string
xmlString)
{
RSACryptoServiceProvider rsaCryptoServiceProvider = new
RSACryptoServiceProvider(dwKeySize);
rsaCryptoServiceProvider.FromXmlString(xmlString);
int keySize = dwKeySize / 8;
byte[] bytes = Encoding.UTF32.GetBytes(inputString);
int maxLength = keySize - 42;
int dataLength = bytes.Length;
int iterations = dataLength / maxLength;
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i <= iterations; i++)
{
byte[] tempBytes = new byte[(dataLength - maxLength * i > maxLength) ?
maxLength : dataLength - maxLength * i];
Buffer.BlockCopy(bytes, maxLength * i, tempBytes, 0, tempBytes.Length);
byte[] encryptedBytes = rsaCryptoServiceProvider.Encrypt(tempBytes, true)
37
Array.Reverse(encryptedBytes);
stringBuilder.Append(Convert.ToBase64String(encryptedBytes));
}
return stringBuilder.ToString();
}
public void Decrypt(object inputObject)
{
object[] inputObjects = (object[])inputObject;
containerControl = (Form)inputObjects[0];
updateTextDelegate = (Delegate)inputObjects[1];
string decryptedString = DecryptString((string)inputObjects[2],
(int)inputObjects[3], (string)inputObjects[4]);
containerControl.Invoke(updateTextDelegate, new object[]
{ decryptedString });
}
public string DecryptString(string inputString, int dwKeySize, string
xmlString)
RSACryptoServiceProvider rsaCryptoServiceProvider = new
RSACryptoServiceProvider(dwKeySize);
rsaCryptoServiceProvider.FromXmlString(xmlString);
int base64BlockSize = ((dwKeySize / 8) % 3 != 0) ? (((dwKeySize / 8) / 3) *
4) + 4 : ((dwKeySize / 8) / 3) * 4;
int iterations = inputString.Length / base64BlockSize;
ArrayList arrayList = new ArrayList();

38
for (int i = 0; i < iterations; i++)
{
byte[] encryptedBytes =
Convert.FromBase64String(inputString.Substring(base64BlockSize * i,
base64BlockSize));
Array.Reverse(encryptedBytes);
arrayList.AddRange(rsaCryptoServiceProvider.Decrypt(encryptedBytes,
true));
}
send=Encoding.UTF32.GetString(arrayList.ToArray(Type.GetType("Syste
m.Byte")) as byte[]);
return=Encoding.UTF32.GetString(arrayList.ToArray(Type.GetType("Syste
m.Byte")) as byte[]);
}
}
}
VIEWING THE DETAILS:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
39
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Cryptography;
using System.Xml.Serialization;
namespace RFID
{
public partial class ProductInfoView : Form
{
private Timer time = new Timer();
public static int currentBitStrength = 0;
public static string userID = "";
public delegate void UpdateBitStrengthDelegate(int bitStrength);
public delegate void UpdateTextDelegate(string inputText);
public static string txt;
public static string txt2;
Data_Access da = new Data_Access();
EncryptionThread decryptionThread = new EncryptionThread();
public ProductInfoView()
{
InitializeComponent();
}
if (File.Exists(Application.StartupPath.ToString() + "/rsa/Private.kez"))
{
StreamReader streamReader = new
StreamReader(Application.StartupPath.ToString() + "/rsa/Private.kez", true);
fileString = streamReader.ReadToEnd();
40
streamReader.Close();
string bitStrengthString = fileString.Substring(0,
fileString.IndexOf("</BitStrength>") + 14);
fileString = fileString.Replace(bitStrengthString, "");
intbitstrength=Convert.ToInt32(bitStrengthString.Replace("<BitStrength>",
"").Replace("</BitStrength>", ""));
string tempStorage = rfid;
if (fileString != null)
{
UdateTextDelegate updateTextDelegate = new
UpdateTextDelegate(UpdateText);
try
{
retValue = DecryptString(rfid, bitStrength, fileString);
}
catch (CryptographicException CEx)
{
MessageBox.Show("ERROR: \nThe cryptographic service provider cannot
be acquired.\nThe length of the text being encrypted is greater than the
maximum allowed length.\nThe OAEP padding is not supported on this
computer.\n" + "Exact error: " + CEx.Message);
}
catch (Exception Ex)
{
MessageBox.Show("ERROR:\n" + Ex.Message);
}
41
private void ProductInfoView_Load(object sender, EventArgs e)
{
gbStandardTechnique.Visible = true;
gbNewTechnique.Visible = false;
groupBox1.Visible = false;
progressBar1.Visible = false;
dataGridView1.Visible = false;
tBarCode.Text = string.Empty;
txtProductCode.Text = string.Empty;
txtPName.Text = string.Empty;
txtQty.Text = string.Empty;
txtRate.Text = string.Empty;
}
private void IncreaseProgressBar(object sender, EventArgs e)
{
progressBar1.Visible = true;
if (progressBar1.Value == progressBar1.Maximum)
{
time.Stop();
progressBar1.Visible = false;
dataGridView1.Visible = true;
}
}

42
private void BtnClear_Click(object sender, EventArgs e)
{
if (txtrfid.Text.Length > 0)
{
if (SB.Length > 0)
{
time.Interval = 50;
time.Start();
da.DBADAPTER("SELECT ProductName [Product
Name],Ingredients,Remarks,ManufacturedBy [Manufactured By],Qty
[Quantity],Rate FROM Products WHERE PID IN('" + SB.ToString() + "')
Order BY PID ASC ", "Products");
dataGridView1.DataSource = da.ds.Tables[0].DefaultView;
da.DBConClose();
if (da.ds.Tables[0].Rows.Count == 0)
{
MessageBox.Show("Record Not Found", "Caption",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtrfid.Focus();
dataGridView1.Visible=false;
}
BtnClear.Enabled = false;
dataGridView1.Visible = false;
cmdEncrypt.Enabled = true;
SB.Remove(0, SB.Length);

43
else
{
MessageBox.Show("Invalid RFID,try again!", "Error!!!",
MessageBoxButtons.OK, MessageBoxIcon.Error);
txtrfid.Focus();
}
public void Decrypt(object inputObject)
{
object[] inputObjects = (object[])inputObject;
containerControl = (Form)inputObjects[0];
updateTextDelegate = (Delegate)inputObjects[1];
string decryptedString = DecryptString((string)inputObjects[2],
(int)inputObjects[3], (string)inputObjects[4]);
containerControl.Invoke(updateTextDelegate, new object[]
{ decryptedString });
}
public string DecryptString(string inputString, int dwKeySize, string
xmlString)
{
RSACryptoServiceProvider rsaCryptoServiceProvider = new
RSACryptoServiceProvider(dwKeySize);
rsaCryptoServiceProvider.FromXmlString(xmlString);
int base64BlockSize = ((dwKeySize / 8) % 3 != 0) ? (((dwKeySize / 8) / 3) *
4) + 4 : ((dwKeySize / 8) / 3) * 4;
int iterations = inputString.Length / base64BlockSize;
ArrayList arrayList = new ArrayList();
44
for (int i = 0; i < iterations; i++)
{
byte[] encryptedBytes =
Convert.FromBase64String(inputString.Substring(base64BlockSize * i,
base64BlockSize));
Array.Reverse(encryptedBytes);
arrayList.AddRange(rsaCryptoServiceProvider.Decrypt(encryptedB
ytes, true));
}
send=ing.UTF32.GetString(arrayList.ToArray(Type.GetType("System.Byte
")) as byte[]);
}
private void picStabdard_Click(object sender, EventArgs e)
{
txtBarCode.Text =
System.Configuration.ConfigurationSettings.AppSettings["PBARCODE"].T
oString();
txtProductCode.Text =
System.Configuration.ConfigurationSettings.AppSettings["PBARCODE"].T
oString();
txtPName.Text =
System.Configuration.ConfigurationSettings.AppSettings["PNAME"].ToStr
ing();
txtQty.Text =

45
System.Configuration.ConfigurationSettings.AppSettings["PQTY"].ToStrin
g();
txtRate.Text =
System.Configuration.ConfigurationSettings.AppSettings["PRATE"].ToStri
ng();
}
class BindRFID
{
private string _RFID;
private int _ID;
public string RFID
{
get
{
return _RFID;
}
set
{
RFID = value;
}
}

46
public int PID
{
get
{
return _ID;
}
set
{
return_ID = value;
}
}
}

47
CHAPTER 7
SAMPLE OUTPUT:

WELCOME SCREEN

48
LOGIN:

49
RFID HOME PAGE:

50
ADMINISTRATOR INFORMATION:

51
ASSIGNING RFID TO EMPLOYEES:

52
VIEWING THE EMPLOYEE DETAILS:

53
TRUNCATING THE DETAILS:

54
MODIFYING THE DETAILS:

55
ADDING PRODUCT DETAILS:

56
VIEWING THE PRODUCT DETAILS USING STANDARD
TECHNIQUE:

57
VIEWING THE DETAILS USING NEW TECHNIQUE:

58
59
CHAPTER 8

CONCLUSION:

We proposed a lightweight authentication protocol based on Gen2 to


resist various attacks. The proposed tag uses no cryptographic function, and
hence, is suitable for low-cost RFID’s.

Without changing the protocol flow of Gen2, the existing reader can
read both Gen2 tags and Gen2þ tags. Gen2þ provides sufficient security
level for real-world settings. We analyzed the number of rounds required
and the period of key update for practical deployment.

60
CHAPTER 9

BIBLIOGRAPHY:

REFERENCES:

BOOKS:

[1] S. Weis, “Security and Privacy in Radio-Frequency Identification


Devices,” master’s thesis, Mass. Inst. of Technology (MIT), May
2003.

[2] G. Avoine and P. Oechslin, “A Scalable and Provably Secure Hash


Based RFID Protocol,” Proc. Third IEEE Int’l Workshop Pervasive
Computing and Comm. Security (PERCOMW ’05), Mar. 2005.

[3] A. Juels, “RFID Security and Privacy: A Research Survey,”


manuscript, RSA Laboratories, Sept. 2005.

[4] S. Weis et al., “Security and Privacy Aspects of Low-Cost Radio


Frequency Identification Systems,” Proc. First Int’l Conf. Security in
Pervasive Computing (SPC ’03), Mar. 2003.

[5] H. Lee and J. Kim, “Privacy Threats and Issues in Mobile RFID,”
Proc. First Int’l Conf. Availability, Reliability and Security (ARES ’06),
Apr. 2006.

WEBSITES:

www.epcglobalinc.org

http://eprint.iacr.org

61