Exploiting Rateless Codes in Cloud Storage Systems

Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

1.

INTRODUCTION

1.1. SYNOPSIS

evaluate how the various ENIGMA system parameters affect the performance,
availabilityBlock-Level Cloud Storage (BLCS) offers to users and applications the access
to persistent block storage devices (virtual disks) that can be directly accessed and used
as if they were raw physical disks. In this paper we devise ENIGMA, architecture for the
back-end of BLCS systems able to provide adequate levels of access and transfer
performance, availability, integrity, and confidentiality, for the data it stores. ENIGMA
exploits LT rate less codes to store fragments of sectors on storage nodes organized in
clusters. We quantitatively , integrity, and confidentiality of virtual disks. These
evaluations are carried out by using both analytical modeling (for availability, integrity,
and confidentiality) and discrete event simulation (for performance), and by considering a
set of realistic operational scenarios. Our results indicate that it is possible to
simultaneously achieve all the objectives set forth for BLCS systems by using ENIGMA,
and that a careful choice of the various system parameters is crucial to achieve a good
compromise among them. Moreover, they also show that LT coding-based BLCS
systems outperform traditional BLCS systems in all the aspects mentioned before.

1
1.2 ABOUT THE PROJECT

Block-Level Cloud Storage (BLCS) is a storage paradigm offering to users and


applications the access to persistent block storage devices (named virtual disks (VD)) that
can be directly accessed and used as if they were raw physical disks. BLCS systems offer
various advantages over alternative data storage solutions (e.g. distributed file systems),
namely: (a) they support cloud applications that require access to persistent raw block
devices (e.g., DBMS), (b) they are natively supported by any off-theshelf operating
system, and (c) the optimizations they provide are transparently available to any off-the-
shelf file system used to format them. Using coding for cloud storage is not a new idea,
and several works have studied in depth solutions to achieve each one of the goals of
BLCS systems (i.e., adequate performance, availability, integrity, and confidentiality).
However, to the best of our knowledge, none of the existing works attempts to achieve all
these goals at the same time. Simultaneously achieving all these goals, however, is not
trivial, as they typically conflict with each other. For instance, as shown later, higher
levels of availability require larger values of n, while higher levels of performance
require lower values of n. Therefore, several trade-offs emerge when all these objectives
must be simultaneously achieved.

2
ALGORITHM:

Random Algorithm: Cryptographically secure pseudo-random number


generator (CSPRNG)

Encryption Algorithm: Elliptic Curve Integrated Encryption Scheme

ENIGMA Architecture

3
2. SYSTEM ANALYSIS

2.1 EXISTING SYSTEM

Most existing public key encryption methods allow a party to encrypt data to a
particular user, but are unable to efficiently handle more expressive types of encrypted
access control. BLCS systems offer various advantages over alternative data storage
solutions (e.g. distributed file systems), namely: (a) they support cloud applications that
require access to persistent raw block devices (e.g., DBMSes), (b) they are natively
supported by any off-the shelf operating system, and (c) the optimizations they provide
are transparently available to any off-the-shelf file system used to format them.

2.1.1 DISADVANTAGES OF EXISTING SYSTEM

□ This solution, however, is affected by performance and availability


problems.

□ If the storage servers are affected by single point of failure means may
easily create a bottleneck problem.

2.2 PROPOSED SYSTEM

In this project we devised a suitable architecture for the back-end of BLCS


systems that achieves adequate levels of access and transfer performance, availability,
integrity, and confidentiality, for the data it stores. We exploited LT rateless codes and
showed how beneficial they are to all system properties we considered. The rateless
property allows to blindly spreading coded fragments to storage nodes in a cluster with
the level of redundancy achieving the desired availability. Moreover, we devised a
particular encoding strategy that for small block sizes guarantees zero decoding failure
probability and improves availability for large values of the grouping factor x.

4
Confidentiality is obtained by keeping the coding key secret, i.e., we assume that proxies
are trusted and cannot be compromised. Furthermore, the lower the values of x the higher
the confidentiality. Rateless codes allow for detection of polluted sectors and accurate
and fast identification of malicious storage nodes. Furthermore, we show that after
identification high recovery probability can be achieved especially for low values of x.
As for the performance, we showed that much better performance than an equivalent-cost
baseline system can be achieved even when caches are small and independently of the
position of proxies in the network.

2.2.1 ADVANTAGES OF PROPOSED SYSTEM

□ Compared to alternative coding schemes LT codes are better suited to the needs
of a BLCS system because of their
□ There is no single point of failure, as the coded fragments are stored on various
independent storage resources
□ Lost fragments (caused by a failed resource) can be regenerated on-the-fly
without the constraint of recreating exactly the lost data.
□ The confidentiality can be achieved by keeping secret the random generation
process and the addresses of the storage resources where fragments are stored.
□ ENIGMA encompasses various mechanisms enabling it to obtain suitable levels
of performance, availability, integrity and confidentiality and that, as such, can be
effectively used as the back-end of a BLCS system.

5
3. SYSTEM ENVIRONMENT

3.1 HARDWARE REQUIREMENT


Processor : I3

Hard Disk : 1TB

RAM : 2GB

Board : Mercury

Key Board : Logitech Key board

Monitor : 21 inch Samsung

Mouse : Logitech

3.2 SOFTWARE REQUIREMENT

Operating System : Windows Family

Front End : ASP.NET

Back End : SQL Server (Database)

6
3.3. SOFTWARE SPECIFICATION

The .NET Framework is a new computing platform that simplifies application


development in the highly distributed environment of the Internet. The .NET Framework
is designed to fulfill the following objectives:

● To provide a consistent object-oriented programming environment whether object


code is stored and executed locally, executed locally but Internet-distributed, or
executed remotely.

● To provide a code-execution environment that minimizes software deployment


and versioning conflicts.

The .NET Framework has two main components: the common language runtime
and the .NET Framework class library. The common language runtime is the foundation
of the .NET Framework. User can think of the runtime as an agent that manages code at
execution time, providing core services such as memory management, thread
management, and remoting, while also enforcing strict type safety and other forms of
code accuracy that ensure security and robustness.

CLIENT APPLICATION DEVELOPMENT

Client applications are the closest to a traditional style of application in Windows-


based programming. These are the types of applications that display windows or forms on
the desktop, enabling a user to perform a task. Client applications include applications
such as word processors and spreadsheets, as well as custom business applications such as
data-entry tools, reporting tools, and so on. Client applications usually employ windows,
menus, buttons, and other GUI elements, and they likely access local resources such as
the file system and peripherals such as printers.

7
SERVER APPLICATION DEVELOPMENT

Server-side applications in the managed world are implemented through runtime


hosts. Unmanaged applications host the common language runtime, which allows custom
managed code to control the behavior of the server. This model provides all the features
of the common language runtime and class library while gaining the performance and
scalability of the host server.

The following illustration shows a basic network schema with managed code
running in different server environments. Servers such as IIS and SQL Server performs
standard operations while application logic executes through the managed code.

INTRODUCTION TO THE C# LANGUAGE AND THE .NET FRAMEWORK

C# is an elegant and type-safe object-oriented language that enables developers to


build a variety of secure and robust applications that run on the .NET Framework. You
can use C# to create Windows client applications, XML Web services, distributed
components, client-server applications, database applications, and much, much more.
Visual C# provides an advanced code editor, convenient user interface designers,
integrated debugger, and many other tools to make it easier to develop applications based
on the C# language and the .NET Framework.

C# syntax is highly expressive, yet it is also simple and easy to learn. The curly-
brace syntax of C# will be instantly recognizable to anyone familiar with C, C++ or Java.
Developers who know any of these languages are typically able to begin to work
productively in C# within a very short time. C# syntax simplifies many of the
complexities of C++ and provides powerful features such as nullable value types,
enumerations, delegates, lambda expressions and direct memory access, which are not
found in Java.

8
4. SYSTEM DESIGN

4.1 SYSTEM FLOW DIAGRAM

9
4.2 DATA FLOW DIAGRAM

Level 0

Level 1

Level 2

10
Level 3
4.3 ER DIAGRAM

12
4.4 DATABASE DESIGN

User Registration

S.No Field Name Field Type Length Description

1 Name Varchar 20 Student Name

2 Age Int - Age

3 Gender Varchar 20 Gender


4 Mob Int - Mobile No

5 Email Varchar 20 Email ID

6 Uname Varchar 20 User Name

7 Password Varchar 20 Password

User Upload

S.No Field Name Field Type Length Description

1 FileID Int 20 File ID

2 FileNam Varchar 30 File Name

3 Keys Int - Key

4 Filesname Varchar 30 Upload Filename

5 Filepath Varchar 50 File Path

13
Key Given

S.No Field Name Field Type Length Description


1 FileID Int 20 File ID
2 FName Varchar 30 File Name
3 Userkey Int - User Key
4 Akey Int - Admin Key

Key Request

S.No Field Name Field Type Length Description


1 FileID Int 20 File ID
2 FName Varchar 30 File Name
3 Userkey Int - User Key
4 MailId Varchar 50 Mail ID

Key Send

S.No Field Name Field Type Length Description


1 FileID Int 20 File ID
2 FName Varchar 30 File Name
3 Userkey Int - User Key
4 MailId Varchar 50 Mail ID
5 Akey Int - Admin Key

14
5. SYSTEM DESCRIPTION

5.1 MODULES

□ User View files


□ File Upload to Cloud Storage
□ Request and Response.
□ Match Key
□ File Size view

MODULE DESCRIPTION

User view files:

Users once register then view the storage files in Cloud. The files downloading option
view in user page. But user download that particular file was encrypted in cloud
storage.

File Upload to Cloud Storage:

File uploading as Admin process, and upload the files in Cloud storage. Here used in
uploading algorithm and also perform in Encryption algorithms used to encrypt the
file to store in cloud storage.

Request & Response:

User can download only encrypted file in viewing part. So user Request the
download key to Admin, again admin process the key request to download.

Admin Response and authenticate the key send to user valid mail id. User receive
the key and match it.

15
Match Key:

Users once receive the key then match it. To click the downloaded file and match
the secret key using random algorithm. If the key was matched then only user can
download the particular original file.

File size view :

Admin views the file size chart. This chart to show the difference between the
original file size to encrypted file size.

16
6. IMPLEMENTATION
Implementation is the process of having the system personal checks out and put
new equipment to use, train the user to use the new system and construct any file that are
needed to see it. The final and important phase in the system life cycle is the
implementation of the new system. The file conversion is the most time consuming and
expensive activity in the implementation stage.
System implementation refers to the step necessary to install a new system to put
into operation. The implementation has different meaning, ranging from the conversion
of a basic application to complete replacement of computer system. Implementation
includes all these activities that take place to convert from old system to new one. The
new system may be totally new replacing an existing manual or automated system or it
may be major modification to an existing system.

The method of implementation and time scale adopted is found out initially. The
system is tested properly and at the same time the users are trained in the new procedure.
Proper implementation is essential to provide a reliable system to meet organization
requirements. Successful implementation may not guarantee improvement in the
organization using the new system, but it will prevent improper installation. The
implementation involves the following things:

● Careful planning

● Investigation of the system and constraints

● Design the methods to achieve the change over

● Train the staff in the changed phase

● Evaluation of change over meth

17
7. TESTING

7.1 UNIT TESTING


▪ A unit is the smallest testable part of an application like functions,
classes, procedures, interfaces. Unit testing is a method by which individual units
of source code are tested to determine if they are fit for use.
▪ Unit tests are basically written and executed by software developers to make sure
that code meets its design and requirements and behaves as expected.
▪ The goal of unit testing is to segregate each part of the program and test that the
individual parts are working correctly.
ADVANTAGES OF UNIT TESTING:

1. Issues are found at early stage. Since unit testing are carried out by developers where
they test their individual code before the integration. Hence the issues can be found very
early and can be resolved then and there without impacting the other piece of codes.

2. Unit testing helps in maintaining and changing the code. This is possible by making
the codes less interdependent so that unit testing can be executed. Hence chances of
impact of changes to any other code get reduced.

3. Unit testing helps in simplifying the debugging process. If suppose a test fails then
only latest changes made in code needs to be debugged.

7.2 SYSTEM TESTING

Testing is the process of verifying whether the system developed satisfies the
requirement specification given by the clients testing is essential at each & every step of
software development.

18
7.3 INTEGRATED TESTING

▪ Integration testing tests integration or interfaces between components, interactions


to different parts of the system such as an operating system, file system and
hardware or interfaces between systems.
▪ Also after integrating two different components together do the integration testing.
As displayed in the image below when two different modules ‘Module A’ and
‘Module B’ are integrated then the integration testing is done.

Fig : 7.2.1 Integration testing diagram

▪ Integration testing is done by a specific integration tester or test team.


▪ Integration testing follows two approach known as ‘Top Down’ approach and
‘Bottom Up’ approach as shown in the image below:

Fig: 7.2.2 Integration testing techniques:

19
1. BIG BANG INTEGRATION TESTING:

Big Bang Integration Testing is an integration testing strategy wherein all units
are linked at once, resulting in a complete system. When this type of testing strategy is
adopted, it is difficult to isolate any errors found, because attention is not paid to
verifying the interfaces across individual units. In this approach individual modules are
not integrated until and unless all the modules are ready.
In Big Bang integration testing all components or modules are integrated
simultaneously, after which everything is tested as a whole.

Fig 7.2.3 Big Bag Integration Testing

Advantage: Big Bang testing has the advantage that everything is finished before
integration testing starts.

Disadvantage: The major disadvantage is that in general it is time consuming and


difficult to trace the cause of failures because of this late integration.

20
2. Top-down integration testing:

Top-down integration testing is an integration testing technique used in order to


simulate the behaviour of the lower-level modules that are not yet integrated. Stubs are
the modules that act as temporary replacement for a called module and give the same
output as that of the actual product.

The replacement for the 'called' modules is known as 'Stubs' and is also used
when the software needs to interact with an external system. Testing takes place from
top to bottom, following the control flow or architectural structure (e.g. starting from the
GUI or main menu). Components or systems are substituted by stubs.

Fig: 7.2.4 Diagram of ‘Top down Approach’

Advantages of top-down approach:

▪ Stubs can be written with lesser time because when compared to the drivers then
Stubs are simpler to author.

Disadvantages of top-down approach:


▪ Basic functionality is tested at the end of cycle

21
3. Bottom-up integration testing: Testing takes place from the bottom of the control
flow upwards. Components or systems are substituted by drivers. Below is the image of

Fig: 7.2.5 Bottom up approach

Advantage of bottom-up approach:


▪ In this approach development and testing can be done together so that the product or
application will be efficient and as per the customer specifications.

Disadvantages of bottom-up approach:


▪ It can catch the Key interface defects at the end of cycle
▪ It is required to create the test drivers for modules at all levels except the top control

22
8. FUTURE ENHANCEMENTS

The future developments foreseen for the current work are a through evaluation of
the malicious storage nodes identification technique presented into assesses accuracy,
robustness and reactivity. Furthermore, a prototype implementation on Planet LAB is
planned for the whole architecture. Future work includes the development of suitable
fragment distribution policies of sector caching strategies, and of fragment migration
techniques supporting the migration of the VM accessing the corresponding virtual disk.
In particular, ENIGMA can be used as a framework for Rateless Regenerating Codes

23
9. CONCLUSION
The back-end of BLCS systems that achieves adequate levels of access and transfer
performance, availability, integrity, and confidentiality, for the data it stores. Exploited
LT rateless codes and showed how beneficial they are to all system properties and
considered. In particular: • the rateless property allows to blindly spread coded fragments
to storage nodes in a cluster with the level of redundancy achieving the desired
availability. Moreover, devised a particular encoding strategy that for small block sizes (k
≤ 32) guarantees zero decoding failure probability and improves availability for large
values of the grouping factor confidentiality is obtained by keeping the coding key secret,
i.e., assume that proxies are trusted and cannot be compromised. Furthermore, the lower
the values of x the higher the confidentiality. Rateless codes allow for detection of
polluted sectors and accurate and fast identification of malicious storage nodes
.Furthermore, show that after identification high recovery probability can be achieved
especially for low values of x. As for the performance, It showed that much better
performance than an equivalent-cost baseline system can be achieved even when caches
are small and independently of the position of proxies in the network.

24
10. APPENDIX
A. SCREEN SHOT

Homepage:

User Registration:

25
User Login:

Encrypt File:

26
File Upload:

List of Files:

27
Key Request:

View Key Report:

28
File Download:

File Decrypt:

29
Admin Login:

Admin- File Download:

30
Admin- File Decrypt:

Admin – Key:

31
Admin – Send Key:

OUTPUT

32
B. SAMPLE CODING

User Registration
Imports System.Data.SqlClient
Partial Class userregister
Inherits System.Web.UI.Page
Public con As SqlConnection
Public cmd As SqlCommand
Public str As String
Public db As New Class1
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
db.connect()
str = "insert into userregister values('" & TextBox1.Text & "'," &
Me.TextBox2.Text & ",'" & Me.TextBox3.Text & "','" & Me.TextBox4.Text & "','" &
Me.TextBox5.Text & "','" & Me.TextBox6.Text & "','" & Me.TextBox7.Text & "')"
cmd = New SqlCommand(str, db.con)
cmd.ExecuteNonQuery()
MsgBox("Record registered successfully. ..... ")
clear()
End If
End Sub
Sub clear()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""

33
End Sub
End Class
User Login
Imports System.Data.SqlClient
Partial Class userlogin
Inherits System.Web.UI.Page
Public con As SqlConnection
Public cmd As SqlCommand
Public str As String
Public db As New Class1
Public dr As SqlDataReader
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
db.connect()
str = "select uname,passwor from userregister where uname='" & TextBox1.Text &
"' and passwor='" & TextBox2.Text & "'"
cmd = New SqlCommand(Str, db.con)
dr = cmd.ExecuteReader
If dr.Read Then
If dr.HasRows Then
If TextBox1.Text = dr(0) And TextBox2.Text = dr(1) Then
MsgBox("User Login successfull..")
Response.Redirect("user\encryption.aspx")
End If
End If
Admin Login
Partial Class adminlogin
Inherits System.Web.UI.Page

34
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Enter all the fields")
ElseIf TextBox1.Text = "admin" And TextBox2.Text = "admin" Then
MsgBox("Welcome Admin")
Response.Redirect("user/download.aspx")
Else
MsgBox("Wrong Username Or Password")
End If
End Sub
End Class
Encryption
Imports System.IO
Imports System.Security.Cryptography
Partial Class user_encryption
Inherits System.Web.UI.Page
Dim count As Integer = 0
Protected Sub EncryptFile_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles EncryptFile.Click
Dim fileName As String =
Path.GetFileNameWithoutExtension(FileUpload2.PostedFile.FileName)

End Sub
End Using
End Using
End Using
End Sub
End Class

35
File Upload
Imports System.IO
Imports System.Data.SqlClient
Partial Class user_fileupload
Inherits System.Web.UI.Page
Public cmd, cmd1, cmd2 As SqlCommand
Public str, str1, str2 As String
Public db As New Class1
Dim dr As SqlDataReader
Dim a, b, c, d, p, count As String
Private Sub auto()
db.connect()
str = "select max(FileID) from user_upload"
cmd = New SqlCommand(str, db.con)
dr = cmd.ExecuteReader
While dr.Read
Me.TextBox1.Text = dr(0) + 1
End While
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Then
MsgBox("Enter all the fields")
cmd = New SqlCommand(str, db.con)
cmd.Parameters.AddWithValue("@Name", filename)
cmd.Parameters.AddWithValue("@Path", "Files/" & filename)
cmd.ExecuteNonQuery()
MsgBox("File Uploaded Success")
auto()

36
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim random As New Random
Dim a As Integer
a = random.Next(1000, 10000)
TextBox3.Text = a
auto()
End Sub
End Class
File Report
Imports System.Data.SqlClient
Imports System.Data
Partial Class user_FileReport
Inherits System.Web.UI.Page
Public cmd, cmd1, cmd2 As SqlCommand
Public str, str1, str2 As String
Public db As New Class1
Dim dr As SqlDataReader
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
End Class

Key Request
Imports System.Data.SqlClient
Imports System.Data
Partial Class user_KeyRequest
Inherits System.Web.UI.Page

37
Public cmd As SqlCommand
Public dr As SqlDataReader
Public str As String
Public db As New Class1
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
db.connect()
str = "select FileID from user_upload"
cmd = New SqlCommand(str, db.con)
dr = cmd.ExecuteReader
While dr.Read
Me.DropDownList1.Items.Add(dr(0))
End While
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or
DropDownList1.Text = "select" Then
MsgBox("Enter all the Fields")
Else
db.connect()
str = "insert into keyrequest values('" & DropDownList1.SelectedItem.Text & "','"
& TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"
cmd = New SqlCommand(str, db.con)
cmd.ExecuteNonQuery()
MsgBox("Success")
End If

38
End Sub
End Class
Key Send Report
Imports System.Data.SqlClient
Imports System.Data
Partial Class user_KeyReport
Inherits System.Web.UI.Page
Public cmd As SqlCommand
Public dr As SqlDataReader
Public str As String
Public db As New Class1
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
db.connect()
str = "select MailId from keysend"
cmd = New SqlCommand(str, db.con)
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
db.connect()
cmd = New SqlCommand("select FileID,FName,Userkey,Akey from keysend where
MailId='" & Me.DropDownList1.SelectedItem.Text & "' ", db.con)
End While
End Sub
End Class
Download
Imports System.Data.SqlClient
Imports System.Data
Partial Class user_userdownload
Inherits System.Web.UI.Page

39
Public cmd As SqlCommand
Public dr As SqlDataReader
Public str As String
Public db As New Class1
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
db.connect()
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
db.connect()
cmd = New SqlCommand("select FName,Userkey from keysend where FileID='" &
Me.DropDownList1.SelectedItem.Text & "' ", db.con)
dr = cmd.ExecuteReader()
While dr.Read
TextBox1.Text = dr.GetValue(0)
TextBox2.Text = dr.GetValue(1)
End While
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button4.Click
Response.Redirect("decryption.aspx")
End Sub
End Class
Decryption
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Imports System.Web.UI.WebControls

40
Imports System.Security.Cryptography
Partial Class user_decryption
Inherits System.Web.UI.Page
Dim str As String
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim db As New Class1
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Response.WriteFile(output)
Response.Flush()
'Delete the original (input) and the decrypted (output) file.
File.Delete(input)
File.Delete(output)
Response.End()
End Sub
Using fsOutput As New FileStream(outputfilePath, FileMode.Create)
Dim data As Integer
While (Assign(data, cs.ReadByte())) <> -1
fsOutput.WriteByte(CByte(data))
End While
End Using
End Using
End Using
End Using
End Sub
End Class

Key Given
Imports System.Data.SqlClient

41
Imports System.Data
Partial Class admin_KeyGiven
Inherits System.Web.UI.Page
Public cmd As SqlCommand
Public dr As SqlDataReader
Public str As String
Public db As New Class1
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Protected Sub Button2_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Button2.Click
db.connect()
cmd = New SqlCommand("select FileNam,keys from user_upload where FileID="
& Me.DropDownList1.SelectedItem.Text & " ", db.con)
dr = cmd.ExecuteReader()
While dr.Read
TextBox1.Text = dr.GetValue(0)
TextBox2.Text = dr.GetValue(1)
End While
End Sub
db.connect()
str = "insert into keygiven values('" & DropDownList1.SelectedItem.Text & "','"
& TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"
cmd = New SqlCommand(str, db.con)
cmd.ExecuteNonQuery()
MsgBox("Success")
End If
End Sub
End Class
Key Request Report

42
Imports System.Data.SqlClient
Imports System.Data
Partial Class admin_KeyRequest
Inherits System.Web.UI.Page
Public cmd As SqlCommand
Public dr As SqlDataReader
Public str As String
Public db As New Class1
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
db.connect()
Dim cmd As New SqlCommand("select * from keyrequest ", db.con)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds)
Gridview1.DataSource = ds
Gridview1.DataBind()
End Sub
End Class

Key Send
Imports System.Data.SqlClient
Imports System.Data
Partial Class admin_Keysend
Inherits System.Web.UI.Page
Public cmd As SqlCommand
Public dr As SqlDataReader
Public str As String
Public db As New Class1

43
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
db.connect()
cmd = New SqlCommand("select FName,Userkey,MailId from keyrequest where
FileID=" & Me.DropDownList1.SelectedItem.Text & " ", db.con)
dr = cmd.ExecuteReader()
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or
TextBox4.Text = "" Or DropDownList1.Text = "select" Then
MsgBox("Enter all the Fields")
Else
db.connect()
str = "insert into keysend values('" & DropDownList1.SelectedItem.Text & "','" &
TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" &
TextBox4.Text & "')"
cmd = New SqlCommand(str, db.con)
cmd.ExecuteNonQuery()
MsgBox("Keysend Success")
End If
End Sub
End Class

44
C. BIBLIOGRAPHY

Books References:

1. Clayton Crooks II ,“Learning .NET Through Applications, 5th Edition, Bpb


Publications

2. Nell B, Programming and Problem Solving With .Net VB.NET: A Laboratory


Course, 2nd Editions, Mc Publications

3. Harvey M. Deitel, Paul J. Deitel, Tem R. Nieto, .NET How to Program, 2nd
Edition, Franklin Publications

4. Richard Bowman .S, VB.NET: Your Visual Blueprint for Building Versatile
Programs on the .NET Framework, I Edition, Jupiter Publications

Web Sources:

1. http://www.sourcecodesworld.com

2. http://www.w3schools.com

3. http://www.vyomworld.com

4. http://www.functionx.com

5. http://www.gotdotnet.com

45
46

You might also like