Académique Documents
Professionnel Documents
Culture Documents
A PROJECT REPORT
Submitted by
Of
VALLAM
APRIL 2011
BONFIDE CERTIFICATE
held on………………………….. .
support
Encouragement.
My heart goes all in gratitude to our family and friends who encouraged
ABSTRACT i
LIST OF TABLES ii
LIST OF FIGURES iii
LIST OF ABBREVIATIONS iii
2 LITERATURE REVIEW 2
2.1 EXISTING SYSTEM 3
2.2 PROPOSED SYSTEM 4
2.3 SCOPE OF THE PROJECT 5
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:
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:
PROPOSED SYSTEM:
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.
CHAPTER 3
SYSTEM REQUIREMENT SPECIFICATION
SOFTWARE REQUIREMENTS:
HARDWARE REQUIREMENTS:
Processor : Intel Pentium IV @ 3.0GHz
Keyboard : 108keys.
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).
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.
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.
16
ASP.NET Windows
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
GARBAGE COLLECTION
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
MULTITHREADING
19
20
CHAPTER 4
PROJECT SPECIFICATITON
MODULE DESCRIPTION
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
24
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
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
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:
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:
[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