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

MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 1
INTRODUCTION

In distributed systems it is sometimes necessary for users to share the


power to use a cryptosystem. The system secret is divided up into shares and
securely stored by the entities forming the distributed cryptosystem. The main
advantage of a distributed cryptosystem is that the secret is never computed,
reconstructed, or stored in a single location, making the secret more difficult
to compromise. In many applications, a threshold (t) or more share
holders are required to cooperatively generate a digital signature, in contrast
to the conventional single signer. This may also be seen as a distribution of
trust since the shareholders must collaborate and contribute equally to
produce a valid multiparty signature.
Threshold-multisignature schemes combine the properties of threshold
group-oriented signature schemes and multisignature schemes. In the
literature, threshold multisignature schemes are also referred to as threshold
signature schemes with trace ability. The combined properties guarantee the
signature verifier that at least ‘t’ members participated in the generation of
the group-oriented signature and that the identities of the signers can be
easily established. The majority of the existing threshold-multisignature
schemes belong to variants of the single signatory generalized ElGamal
signatures extended to a group/multiparty setting.

1
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 2
PROBLEM DEFINITON

Digital signature is a cryptographic tool to authenticate electronic


communications. Digital signature scheme allows a user with a public key and
a corresponding private key to sign a document in such a way that anyone
can verify the signature on the document (using her/his public key), but no
one can forge the signature on any other document. This self-authentication is
required for some applications of digital signatures such as certification by
some authority.

In most situations, the signer is generally a single person. However, in


some cases the message is sent by one organization and requires the
approval or consent of several people. In these cases, the signature
generation is done by more than one consenting person. A common example
of this policy is a large bank transaction, by one organization, which requires
the signature of more than one partner. Such a policy could be implemented
by having a separate digital signature for every required signer, but this
solution increases the effort to verify the message linearly with the number of
signer.

Impersonation of a user is a problem that cannot be dealt with in


Threshold Signature Schemes i.e. there is no way to ensure that a user is who
he claims to be. In Multisignature Scheme there is no way to verify if the user
belongs to a particular group or not.

2
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 3
LITERATURE SURVEY

In (t, n) threshold signature scheme, any subgroup of t or more


shareholders of the designated group can generate a valid group signature in
such a way that the verifier can check the validity of the signature without
identifying the identities of the signers. In threshold schemes, when any t or
more shareholders act in collusion, they can impersonate any other set of
shareholders to forge the signatures. In this case, the malicious set of signers
does not have any responsibility for the signatures and it is impossible to
trace the signers. Unfortunately, with threshold schemes proposed so far, this
problem cannot be solved.

In multisignature schemes, the signers of a multisignature are identified


in the beginning and the validity of the multisignature has to be verified with
the help of identities of the signers. For multisignatures, it is indeed
unnecessary to put a threshold value to restrict the number of signers.
Consider the situation, where a group of anonymous members would have to
generate a multisignature. The members of this group use pseudonyms as
their identities in the public directory. What concerns the verifier most is that
a message is signed by at least t members and they indeed come from that
group. Nevertheless, the verifier has no way to verify whether a user is in fact
a member of that group because of the anonymity of the membership. In this
case, the multisignature schemes cannot solve this problems, however, the
threshold signature schemes do.

On the other hand, there are so many situations, when the signed
message is sensitive to the signature receiver. Signatures used in such

3
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

situations are called directed signatures. In directed signature scheme, the


signature receiver has full control over the signature verification process and
can prove the validity of the signature to any third party, whenever
necessary. Nobody can check the validity of signature without his cooperation.

Combining these ideas, we propose a digital signature scheme named as


Directed - threshold multi - signature scheme. The proposed scheme is based
on Shamir’s threshold signature scheme [6] and Schnorr signature scheme
[7].

4
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

3.1 WHY JAVA

The Internet helped catapult Java to the forefront of programming, and


Java, in turn, has had a profound effect on the Internet. The reason for this is
quite simple: Java expands the universe of objects that can move about freely
in cyberspace. In a network, two very broad categories of objects are
transmitted between the server and your personal computer: passive
information and dynamic, active programs. For example, when you read your
e-mail, you are viewing passive data. Even when you download a program,
the program’s code is still only passive data until you execute it. However, a
second type of object can be transmitted to your computer: a dynamic, self-
executing program. Such a program is an active agent on the client computer,
yet the server initiates it. For example, the server to display properly the data
that the server is sending might provide a program.
Java was conceived by James Gosling, Patrick Naughton, Chris Wrath,
Ed Frank, and Mike Sheridan at Sun Micro system. It is an platform
independent programming language that extends it’s features wide over the
network.Java2 version introduces an new component called “Swing” – is a set
of classes that provides more powerful & flexible components than are
possible with AWT,
- It’s a light weight package, as they are not implemented by platform-specific
code.
-related classes are contained in javax.swing and its sub packages, such as
javax.swing.tree.
-components explained in the Swing have more capabilities than those of
AWT.

5
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

3.1.1 THE JAVA BUZZWORDS

Although the fundamental forces that necessitated the invention of


Java are portability and security, other factors also played an important role in
molding the final form of the language.
The key considerations were summed up by the Java team in the
following list of buzzwords:

 Simple
 Secure
 Portable
 Object-oriented
 Robust
 Multithreaded
 Architecture-neutral
 Interpreted and High performance
 Distributed
 Dynamic

Simple:

Java was designed to be easy for the professional programmer to


learn and use effectively. Assuming that you have some programming
experience, you will not find Java hard to master. If you already understand
the basic concepts of object-oriented programming, learning Java will be even
easier.

Secure:

6
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

When you use a Java-compatible web browser, you can safely


download Java applets without fear of viral infection or malicious intent. Java
achieves this protection by confining a Java program to the Java execution

environment and not allowing it access to other parts of the computer. The
ability to download applets with confidence that no harm will be done and that
no security will be breached is considered by many to be the single most
important aspect of Java.

Portable:

Many types of computers and operating systems are in use


throughout the world and many are connected to the Internet. For programs
to be dynamically downloaded to all the various types of platforms connected
to the Internet, some means of generating portable executable code is
needed. As you will soon see, the same mechanism that helps ensure security
also helps create portability. Indeed, Java’s solution to these two problems is
both elegant and efficient.

Object-oriented:

Although influenced by its predecessors, Java was not designed to be


source-code compatible with any other language. This allowed the Java team
the freedom to design with a blank slate. One outcome of this was a clean,
usable, pragmatic approach to objects. Borrowing liberally from many seminal
object-software environments of the last few decades, Java manages to strike
a balance between the purists’s “everything is an object” paradigm and the
pragmatist’s “stay out of my way” model. The object model in Java is simple
and easy to extend, while simple types, such as integers, are kept as high-
performance non-objects.

Robust:

7
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

The multi-platformed environment of the web places extraordinary


demands on a program, because the program must execute reliably on a
variety of systems. Thus, the ability to create robust programs was given a
high priority in the design of java. By improving the concepts of memory

management and exception handling techniques, Java has become robust in


nature.

Multithreaded:

Java was designed to meet the real-world requirement of creating


interactive, networked programs. To accomplish this, Java supports
multithreaded programming, which allows you to write programs that do
many things simultaneously. The Java run-time system comes with an elegant
yet sophisticated solution for multi-process synchronization that enables you
to construct smoothly running interactive systems. Java’s easy-to-use
approach to multithreading allows you to think about the specific behavior of
your program, not the multitasking subsystem.

Architecture-Neutral:

A central issue for the java designers was that of code longevity and
portability. One of the main problems facing programmers is that no
guarantee exists that if you write a program today, it will run tomorrow –
even on the same machine. Operating system upgrades, processor upgrades,
and changes in core system resources can all combine to make a program
malfunction. The Java designers made several hard decisions in the Java
language and the Java Virtual Machine in an attempt to alter this situation.
Their goal was “write once; run anywhere, any time, forever.” To a great
extent, this goal was accomplished.

Interpreted and High performance:

8
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

As described earlier, Java enables the creation of cross-platform


programs by compiling into an intermediate representation called Java byte
code. This code can be interpreted on any system that provides a Java Virtual
Machine. Most previous attempts at cross-platform solutions have done so at
the expense of performance. Other interpreted systems, such as BASIC, Tcl,

and PERL, suffer from almost insurmountable performance deficits. Java,


however, was designed to perform well on very low-power CPUs. As explained
earlier, while it is true that Java was engineered for interpretation, the java
byte code was carefully designed so that it would be easy to translate directly
into native machine code for very high performance by using a just-in-time
compiler. Java run-time systems that provide this feature lose none of the
benefits of the platform-independent code. “High-performance cross-platform”
is no longer an oxymoron.
Distributed:

Java is designed for the distributed environment of the Internet,


because it handles TCP/IP protocols. In fact, accessing a resource using a URL
is not much different from accessing a file. The original version of Java (Oak)
included features for intra-address-space messaging. This allowed objects on
two different computers to execute procedures remotely. Java has recently
revived these interfaces in a package called Remote Method Invocation (RMI).
This feature brings an unparalleled level of abstraction to client/server
programming.
Dynamic:
Java programs carry with them substantial amounts of run-time type
information that is used to verify and resolve accesses to objects at run time.
This makes it possible to dynamically link code in a safe and expedient
manner. This is crucial to the robustness of the applet environment, in which

9
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

small fragments of byte code may be dynamically updated on a running


system.

Java is also unusual in that each Java program is both compiled and
interpreted. With a compiler, you translate a Java program into an
intermediate language called Java byte codes--the platform-independent
codes interpreted by the Java interpreter. With an interpreter, each Java byte

code instruction is parsed and run on the computer. Compilation happens just
once; interpretation occurs each time the program is executed. This figure
illustrates how this works.

3.1 Compilation of a Java Program

Java byte codes can be considered as the machine code instructions for
the Java Virtual Machine (Java VM). Every Java interpreter, whether it's a
Java development tool or a Web browser that can run Java applets, is an
implementation of the Java VM. The Java VM can also be implemented in
hardware. Java byte codes help make "write once, run anywhere" possible.
The Java program can be compiled into byte codes on any platform that has a
Java compiler. The byte codes can then be run on any implementation of the
Java VM. For example, the same Java program can run on Windows NT,
Solaris, and Macintosh.

10
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

3.2 Implementation of Java Program on different platforms

3.1.2 The Java Platform


A platform is the hardware or software environment in which a program
runs. The Java platform differs from most other platforms in that it's a
software-only platform that runs on top of other, hardware-based platforms.
Most other platforms are described as a combination of hardware and
operating system.

The Java platform has two components:

• The Java Virtual Machine (Java VM)


• The Java Application Programming Interface (Java API)

11
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

The Java API is a large collection of ready-made software components


that provide many useful capabilities, such as graphical user interface (GUI)
widgets. The Java API is grouped into libraries (packages) of related
components.

The following figure depicts a Java program, such as an application or


applet, that's running on the Java platform. As the figure shows, the Java API
and Virtual Machine insulates the Java program from hardware dependencies.

3.3 Java Program running on a Java Platform

As a platform-independent environment, Java can be a bit slower than


native code. However, smart compilers, well-tuned interpreters, and just-in-
time byte code compilers can bring Java's performance close to that of native
code without threatening portability.

12
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 4
PROJECT REQUIREMENT DEFINITION

For the successful execution of the project the some presumptions are
made and they have to be taken care of.
Message can be sent by a single user or the entire group. Any group can
send the message. Here we assume that only one message can be sent at a
time and another message can be sent only when the receiver has agreed to
view the message. Also, we have implemented the project in such a way that
only one group can be the sender and the other groups are disabled. One user
cannot send a message to an entire group nor is it possible for a whole group
to send a message to a single user.
All the users in a group are required to sign in, in order to validate the
message and send it. There is no facility for only a few users of the group to
sign the message and send it to a few users in the other group.
The message can be seen by the receiver only after correct login. It is
only after the receiver has received a message that the sender can send
another message.
The user would ideally enter their respective key all by himself but since
it’s difficult to ensure that the key values in an ascending order as to satisfy
the criteria n1 < n2 < ….< ni the third part is made to generate the values for
encryption on behalf of the user thus taking burden off the user.

13
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

The database is already present and can’t make changes unless we


make changes to the database directly and not through the user interface.
Each time user authentication has to be done, the database is contacted and
the same database is used by both the sender and the receiver.
The encryption and decryption is taken care completely by the third
party. As soon as the sender sends the message, the message is encrypted
and stored. The message is displayed only when the receiver has correctly
logged in and has accepted to view the message.

14
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 5
SYSTEM REQUIREMENTS DEFINITION

SOFTWARE SPECIFICATON
• Java1.4 or More
• Swings
• Windows 98

HARDWARE SPECIFICATION
• Hard disk: 40 GB
• RAM: 128mb
• Processor: Pentium 4
• Monitor: 15” color monitor
• Floppy drive: 1.44 MB
• Mouse: HCL
• CD Drive: LG 52X
• Printer: Laser

USER REQUIREMENTS
Once identified, the user requirements effectively lay the foundation for
developers, testers and implementers to begin determining the functionality,
responsiveness and interoperability required of that system. Here we are
required to create a threshold-multisignature scheme which allows a group of
members to sign the message collaboratively.

15
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 6
GANTT CHART

W eeks
Tasks 1 2 3 4 5 6 7 8 9 10 11 12 13 14
L it e r a tu r e S u r v e y
P r o je c t A p p r o v a l
R e q u ir e m e n t A n a ly s is
S y s t e m D e s ig n
D e t a ile d D e s ig n
Im p le m e n t a t io n
In t e g r a t io n
U n it T e s t in g
F u n c t io n a l T e s t in g
D o c u m e n t a t io n
P r o je c t D e p lo y m e n t
P r o je c t C o m p le t io n

Key:

Project Start Week 1 : Jan 28 – Feb 2

Milestones Week 14 : Apr 28 – May 3

Project End

16
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 7
SYSTEM DESIGN
• A structured multisignature scheme is an order-sensitive multisignature.
• Participating signers need to sign messages with a specified signing
order.
• Assume t signers U1, U2,…, Ut in a group.

• The specified signing order is〈U1, U2,…, Ut〉


• Follow RSA scheme
• Select two large secret primes pi and qi

• Publish product ni

• Determine the public key ei and private key di

• Publicly known products n1, n2,…, nt need to satisfy n1 < n2 < … < nt

• The message is m (say)

• U1 computes S1 = h(m)d1 mod n1

• Send S1 to U2

• U2 computes S2 = S1d2 mod n2

• Send S2 to U3

• U3, U4,…,Ut ,do the similar computation

• St is the order-sensitive multisignature

• The verifier needs to reverse the signing order

• Check h(m) = ((…((Stet mod nt)et-1 mod nt-1)…)e1 mod n1)

17
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

• The commutative law does not apply to modular multiplication that


involves two different moduli ni and nj with gcd(ni, nj) = 1

• That is, (a mod ni) mod nj ? (a mod nj) mod n

where a > ni , and a > nj

• If the multisignature is signed by signers without following the specified


order, the multisignature cannot be verified successfully.

7.1 SYSTEM ARCHITECHTURE

18
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

7.1 System Architechture

7.2 SENDER MODULE

19
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

7.1 Data Flow Diagram of Sender Module

7.3 THIRDPARTY MODULE

20
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

7.2 Data Flow Diagram of Thirdyparty Module

7.3 RECEIVER MODULE

21
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

7.3 Data Flow Diagram of Receiver Module

CHAPTER 8
DETAILED DESIGN

22
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

8.1 PSEUDOCODE OF MULTISIGNATURE SCHEME

8.1.1 LOGIN

Start:
Read username and password
Check for availability in database
If (available)
Display successful login message
Goto sender module
Else
Display invalid login message
Endif
End

8.1.2 SENDER

start:
select receiver group and username
read the message
send the receiver address, sender address and message to third party
end

8.1.3. RECEIVER

Start:
Read groupnumber, username and password
Check for availability in database
If (available)
Display successful login message
Give request to third party
Read response from third party
If (message = no message found)
Display the message
Else
Extract sender info from message
Display sender info and message
Endif
End

23
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

8.1.4 THIRDPARTY

Start:
Read message
Extract sender info from message
If (sender = group1)
If (sender = admin)
Generate p and q values
Generate n1,n2,n3 and n4 such that n1<n2<n3<n4
Generate e1,e2,e3,e4
Generate d1,d2,d3,d4
Generate s1 using n1 and e1
Generate s2 using n2 and e2
Generate s3 using n3 and e3
Generate s4 using n4 and e4
Save cipher s4 and decryption keys in database
Else
Generate p and q values
Generate n
Generate e
Generate d
Generate s using n and e
Save cipher s and decryption key in database
End if
Else
If (sender = admin)
Check for message in database
If (no message found)
Send response as no message found
Else
Get the cipher and decryption keys
Generate s3 using n4 and d4
Generate s2 using n3 and d3
Generate s1 using n2 and d2
Generate message using n1 and d1
Send message and sender info to receiver
Endif
Else
Check for message in database
If (no message found)
Send response as no message found
Else
Get the cipher and decryption key

24
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

Generate message using n and d


Send message and sender info to receiver
Endif
Endif
End

8.2 CLASS DIAGRAM

8.2.1 SENDER MODULE

25
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

ADMINLOGIN

Connectdb()
Sender()

New SENDER
sender()
HOME1 Recvrfm()

New
adminlogin()
New login()
LOGIN

Connectdb()
Sender()
New sender()
SENDERHELP
showwin()

Receiver Module:

RECVR
RECEIVER RECEIVER HELP
readusn()
new recvr() Readpass() Showwin()
Validate()
sendreqtoTP()
readresponse()
displaythemessage()

8.2.2 THIRDPARTY MODULE

26
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

THIRDPARTYPROCESS

mainmethod()
THIRD PARTY Senderside()
Reciverside()
Generatepq()
new Generaten()
thirdpartyprocess() Generate()
Generated()
Encrypt()
Decrypt()

27
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 9
IMPLEMENTATION
Sender Module
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class adminlogin implements ActionListener


{
JButton jbexit = new JButton("Exit");
JButton jbback = new JButton("Back");
JButton jblogin = new JButton("Login");
JTextField jt1,jt2,jt3,jt4;
JPasswordField jp1,jp2,jp3,jp4;
JFrame jfadmin;

public adminlogin()
{
Jfadmin = new JFrame("Group Login");
Container cp=jfadmin.getContentPane();
cp.setLayout(null);
cp.setBackground(Color.green);
Font f = new Font("Helvetica",Font.BOLD,20);
JLabel jl1 = new JLabel("USER1 LOGIN:");
JLabel jl2 = new JLabel("USER2 LOGIN:");
JLabel jl3 = new JLabel("USER3 LOGIN:");

28
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

JLabel jl4 = new JLabel("USER4 LOGIN:");


jl1.setFont(f);
jl2.setFont(f);
jl3.setFont(f);
jl4.setFont(f);
jl1.reshape(100,30,200,30);
jl2.reshape(100,130,200,30);
jl3.reshape(100,220,200,30);
jl4.reshape(100,300,200,30);
cp.add(jl1);
cp.add(jl2);
cp.add(jl3);
cp.add(jl4);
JLabel jlu1 = new JLabel("USER NAME:");
JLabel jlu2 = new JLabel("USER NAME:");
JLabel jlu3 = new JLabel("USER NAME:");
JLabel jlu4 = new JLabel("USER NAME:");
jlu1.reshape(10,70,100,20);
jlu2.reshape(10,160,100,20);
jlu3.reshape(10,250,100,20);
jlu4.reshape(10,330,100,20);
cp.add(jlu1);
cp.add(jlu2);
cp.add(jlu3);
cp.add(jlu4);
JLabel jlp1 = new JLabel("PASSWORD:");
JLabel jlp2 = new JLabel("PASSWORD:");
JLabel jlp3 = new JLabel("PASSWORD:");
JLabel jlp4 = new JLabel("PASSWORD:");

29
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

jlp1.reshape(10,100,100,20);
jlp2.reshape(10,190,100,20);
jlp3.reshape(10,280,100,20);
jlp4.reshape(10,360,100,20);
cp.add(jlp1);
cp.add(jlp2);
cp.add(jlp3);
cp.add(jlp4);
jt1 = new JTextField();
jt2 = new JTextField();
jt3 = new JTextField();
jt4 = new JTextField();
jt1.reshape(150,70,100,20);
jt2.reshape(150,160,100,20);
jt3.reshape(150,250,100,20);
jt4.reshape(150,330,100,20);
cp.add(jt1);
cp.add(jt2);
cp.add(jt3);
cp.add(jt4);
jp1 = new JPasswordField();
jp2 = new JPasswordField();
jp3 = new JPasswordField();
jp4 = new JPasswordField();
jp1.reshape(150,100,100,20);
jp2.reshape(150,190,100,20);
jp3.reshape(150,280,100,20);
jp4.reshape(150,360,100,20);
cp.add(jp1);

30
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

cp.add(jp2);
cp.add(jp3);
cp.add(jp4);
cp.add(jbexit);
jbexit.reshape(190,400,80,30);
cp.add(jbback);
jbback.reshape(10,400,80,30);
cp.add(jblogin);
jblogin.reshape(100,400,80,30);
jfadmin.setBounds(50,30,300,500);
jfadmin.setVisible(true);
jbexit.addActionListener(this);
jbback.addActionListener(this);
jblogin.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == jbexit)
ystem.exit(0);
else
if(ae.getSource() == jbback)
{
jfadmin.dispose();
new home();
}
else
if (ae.getSource() == jblogin)
{
try

31
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

{
String u1 = jt1.getText();
String p1 = jp1.getText();
String u2 = jt2.getText();
String p2 = jp2.getText();
String u3 = jt3.getText();
String p3 = jp3.getText();
String u4 = jt4.getText();
String p4 = jp4.getText();
if(u1.equals(u2) || u1.equals(u3) || u1.equals(u4))
{
JOptionPane.showMessageDialog ((Component) null, "Enter correct
usernames.", "Click OK", JOptionPane.INFORMATION_MESSAGE);
}
else
if (u2.equals(u3) || u2.equals(u4) || u3.equals(u4))
{
JOptionPane.showMessageDialog ((Component) null, "Enter correct
usernames.", "Click OK", JOptionPane.INFORMATION_MESSAGE);
}
else
{
String grp = "group1";
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection ("jdbc:odbc:multi");
PreparedStatement pst = con.prepareStatement ("select * from login where
groupid=? and username=? and pass=?");
pst.setString(1,grp);
pst.setString(2,u1);

32
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

pst.setString(3,p1);
ResultSet rs = pst.executeQuery();
if (rs.next())
{
System.out.println ("valid user1");
PreparedStatement pst1=con.prepareStatement ("select * from login where
groupid=? and username=? and pass=?");
pst1.setString(1,grp);
pst1.setString(2,u2);
pst1.setString(3,p2);
ResultSet rs1 = pst1.executeQuery();
if (rs1.next())
{
System.out.println ("valid user2");
PreparedStatement pst2=con.prepareStatement ("select * from login where
groupid=? and username=? and pass=?");
pst2.setString(1,grp);
pst2.setString(2,u3);
pst2.setString(3,p3);
ResultSet rs2=pst2.executeQuery();
if (rs2.next())
{
System.out.println ("valid user3");
PreparedStatement pst3=con.prepareStatement ("select * from login where
groupid=? and username=? and pass=?");
pst3.setString(1,grp);
pst3.setString(2,u4);
pst3.setString(3,p4);
ResultSet rs3 = pst3.executeQuery();

33
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

if (rs3.next())
{
System.out.println("valid user4");
jfadmin.dispose();
new sender("admin");
}
else
{
JOptionPane.showMessageDialog ((Component) null, "Invalid user4 login",
"Click OK",JOptionPane.INFORMATION_MESSAGE);
}
}
else
{
JOptionPane.showMessageDialog ((Component) null, "Invalid user3 login",
"Click OK", JOptionPane.INFORMATION_MESSAGE);
}
}
else
{
JOptionPane.showMessageDialog((Component) null, "Invalid user2 login",
"Click OK", JOptionPane.INFORMATION_MESSAGE);
}
}
else
{
JOptionPane.showMessageDialog ((Component) null, "Invalid user1 login",
"Click OK", JOptionPane.INFORMATION_MESSAGE);
}

34
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
}

Third Party Module

import java.net.*;

import java.io.*;

import java.sql.*;

import java.util.*;

import java.util.Random.*;

import java.math.BigInteger;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.event.*;

class thirdpartyprocess implements Runnable

35
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

char chstr[] = new char[512];

int size = 16;

int readcnt = 0;

BufferedReader in1;

BigInteger p,q;

ServerSocket ss;

Socket soc;

Vector v = new Vector();

Thread t1;

thirdparty myparent;

public thirdpartyprocess(Socket insocket1,thirdparty parent)

this.myparent = parent;

try

System.out.println("in thirdparty process");

t1 = new Thread(this,"get");

soc = insocket1;

t1.start();

catch(Exception e)

System.out.println(e);

36
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

/*----------------------------------------mainmethod----------------------------*/

void mainmethod()

try

in1 = new BufferedReader(new InputStreamReader(soc.getInputStream()));

while(true)

readcnt = in1.read(chstr);

if(readcnt <=0)

continue;

else

break;

String instring = new String(chstr, 0, readcnt);

System.out.println(instring);

myparent.jtaw.append("\n"+instring+"\n");

StringTokenizer st = new StringTokenizer(instring,"^");

while(st.hasMoreTokens())

v.add(st.nextToken());

37
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

String sgt = v.get(0).toString();

System.out.println("sgt ="+sgt);

if (sgt.equals("sender"))

System.out.println("Sender side method");

myparent.jtaw.append("\nmessage from sender\n");

senderside();

else

System.out.println("receiver side method");

myparent.jtaw.append("\nmessage from receiver\n");

receiverside();

catch(Exception e)

System.out.println(e);

38
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

/*---------------------------------run------------------------------------------*/

public void run()

try

while(true)

mainmethod();

catch(NullPointerException e)

/*-----------------------------------senderside-----------------------------------*/

void senderside()

String encmsg = null;

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

39
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

Connection conn = DriverManager.getConnection("jdbc:odbc:multi");

System.out.println("thirdparty sender side..");

String sg = v.get(1).toString();

String sid = v.get(2).toString();

String rg = v.get(3).toString();

String rid = v.get(4).toString();

String stemp = v.get(5).toString();

for( int i = 0 ; i < v.size() ; i++ )

System.out.println(v.elementAt(i));

if (sid.equals("admin"))

myparent.jtaw.append("Sender is admin\n");

generatePQ();

BigInteger n1 = generateN(p,q);

myparent.jtaw.append("n1="+n1+"\n");

BigInteger e1 = generateE(p,q,size);

myparent.jtaw.append("e1="+e1+"\n");

BigInteger d1 = generateD(p,q,e1);

myparent.jtaw.append("d1 ="+d1+"\n");

System.out.println("n1:"+n1+" e1:"+e1+" d1:"+d1);

BigInteger n2 = new BigInteger("0");

BigInteger n3 = new BigInteger("0");

BigInteger n4 = new BigInteger("0");

40
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

while(n2.compareTo(n1) == -1 || n2.compareTo(n1) == 0)

generatePQ();

n2 = generateN(p,q);

myparent.jtaw.append("\nn2 ="+n2+"\n");

BigInteger e2 = generateE(p,q,size);

BigInteger d2 = generateD(p,q,e2);

myparent.jtaw.append("e2 ="+e2+"\td2 ="+d2+"\n");

System.out.println("n2:"+n2+" e2:"+e2+" d2:"+d2);

while(n3.compareTo(n2) == -1 || n3.compareTo(n2) == 0)

generatePQ();

n3 = generateN(p,q);

myparent.jtaw.append("\nn3 ="+n3+"\n");

BigInteger e3 = generateE(p,q,size);

BigInteger d3 = generateD(p,q,e3);

myparent.jtaw.append("e3 ="+ e3 +"\td3 ="+ d3 +"\n");

System.out.println("n3:"+n3+" e3:"+e3+" d3:"+d3);

while(n4.compareTo(n3) == -1 || n4.compareTo(n3) == 0)

generatePQ();

n4 = generateN(p,q);

41
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

myparent.jtaw.append("\nn4 ="+n4+"\n");

BigInteger e4 = generateE(p,q,size);

BigInteger d4 = generateD(p,q,e4);

myparent.jtaw.append("e4 ="+e4+"\td4 ="+d4+"\n");

BigInteger msg = new BigInteger(stemp.getBytes());

System.out.println("bigint: "+msg);

myparent.jtaw.append("Msg ="+msg+"\n");

BigInteger s1 = encrypt(msg,e1,n1);

myparent.jtaw.append("s1 ="+s1+"\n");

BigInteger s2 = encrypt(s1,e2,n2);

myparent.jtaw.append("s2 ="+s2+"\n");

BigInteger s3 = encrypt(s2,e3,n3);

myparent.jtaw.append("s3 ="+s3+"\n");

BigInteger s4 = encrypt(s3,e4,n4);

myparent.jtaw.append("s4 = cipher ="+s4+"\n");

BigInteger cypher = s4;

PreparedStatement pst = conn.prepareStatement("insert


into adminmsg values(?,?,?,?,?,?,?,?,?,?,?)");

pst.setString(1,sg);

pst.setString(2,rg);

pst.setString(3,cypher.toString());

pst.setString(4,n1.toString());

pst.setString(5,n2.toString());

42
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

pst.setString(6,n3.toString());

pst.setString(7,n4.toString());

pst.setString(8,d1.toString());

pst.setString(9,d2.toString());

pst.setString(10,d3.toString());

pst.setString(11,d4.toString());

pst.executeUpdate();

myparent.jtaw.append("Message saved to database\n");

else

myparent.jtaw.append("sender is user\n");

generatePQ();

BigInteger n = generateN(p,q);

myparent.jtaw.append("n ="+n+"\n");

BigInteger e = generateE(p,q,size);

myparent.jtaw.append("e ="+e+"\n");

BigInteger d = generateD(p,q,e);

myparent.jtaw.append("d ="+d+"\n");

BigInteger msg = new BigInteger(stemp.getBytes());

myparent.jtaw.append("msg ="+msg+"\n");

System.out.println("Biginteger: "+msg);

BigInteger cypher = encrypt(msg,e,n);

myparent.jtaw.append("Cipher ="+cypher+"\n");

43
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

PreparedStatement pst = conn.prepareStatement ("insert


into usermsg values(?,?,?,?,?,?,?)");

pst.setString(1,sg);

pst.setString(2,sid);

pst.setString(3,rg);

pst.setString(4,rid);

pst.setString(5,cypher.toString());

pst.setString(6,n.toString());

pst.setString(7,d.toString());

pst.executeUpdate();

myparent.jtaw.append("cypher saved in database\n");

catch(Exception e)

System.out.println(e);

/*---------------------------------------reciverside-------------------------------*/

void receiverside()

try

44
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection conn = DriverManager.getConnection("jdbc:odbc:multi");

BufferedOutputStream fout = new BufferedOutputStream

(soc.getOutputStream());

String rg = v.get(1).toString();

String rid = v.get(2).toString();

if (rid.equals("admin"))

myparent.jtaw.append("receiver is admin"+"\nchecking for


messages in database\n");

PreparedStatement pst1 = conn.prepareStatement("select *


from adminmsg where receivergid =?");

pst1.setString(1,rg);

ResultSet rs1 = pst1.executeQuery();

if (!(rs1.next()))

myparent.jtaw.append("no message found\n");

String data = "NO MESSAGE FOUND!";

fout.write(data.getBytes());

fout.flush();

else

myparent.jtaw.append("one message found\n");

45
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

String sgid = rs1.getString(1);

BigInteger cipher = new BigInteger(rs1.getString(3));

BigInteger n1 = new BigInteger(rs1.getString(4));

BigInteger n2 = new BigInteger(rs1.getString(5));

BigInteger n3 = new BigInteger(rs1.getString(6));

BigInteger n4 = new BigInteger(rs1.getString(7));

BigInteger d1 = new BigInteger(rs1.getString(8));

BigInteger d2 = new BigInteger(rs1.getString(9));

BigInteger d3 = new BigInteger(rs1.getString(10));

BigInteger d4 = new BigInteger(rs1.getString(11));

myparent.jtaw.append("cipher ="+cypher+"\n");

BigInteger s4 = decrypt(cypher,d4,n4);

myparent.jtaw.append("s4 ="+s4+"\n");

BigInteger s3 = decrypt(s4,d3,n3);

myparent.jtaw.append("s3 ="+s3+"\n");

BigInteger s2 = decrypt(s3,d2,n2);

myparent.jtaw.append("s2 ="+s2+"\n");

BigInteger s1 = decrypt(s2,d1,n1);

myparent.jtaw.append("s1 ="+s1+"\n");

System.out.println("s1: "+s1);

String msg = new String(s1.toByteArray());

System.out.println("Message: "+msg);

myparent.jtaw.append("msg ="+msg+"\n");

String data = sgid+"^"+msg;

46
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

fout.write(data.getBytes());

fout.flush();

myparent.jtaw.append("message sent to receiver\n");

else

myparent.jtaw.append("Receiver is a user\nChecking for


messages in database\n");

PreparedStatement pst1 = conn.prepareStatement("select *


from usermsg where receivergid=? and receiverid=?");

pst1.setString(1,rg);

pst1.setString(2,rid);

ResultSet rs1 = pst1.executeQuery();

if (!(rs1.next()))

myparent.jtaw.append("No message found\n");

String data = "NO MESSAGE FOUND!";

fout.write(data.getBytes());

fout.flush();

else

myparent.jtaw.append("One message found\n");

47
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

String sgid = rs1.getString(1);

String sid = rs1.getString(2);

BigInteger cypher = new BigInteger(rs1.getString(5));

myparent.jtaw.append("cipher ="+cypher+"\n");

BigInteger n = new BigInteger(rs1.getString(6));

myparent.jtaw.append("n ="+n+"\n");

BigInteger d = new BigInteger(rs1.getString(7));

myparent.jtaw.append("d ="+d+"\n");

BigInteger plain=decrypt(cypher,d,n);

String msg = new String(plain.toByteArray());

myparent.jtaw.append("msg ="+msg+"\n");

String data = sgid+"^"+sid+"^"+msg;

fout.write(data.getBytes());

fout.flush();

myparent.jtaw.append("Msg sent to receiver\n");

catch(Exception e)

48
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

/*--------------------------generate p,q------------------------------------------*/

//If the "generate pq" button is pushed then get the desired size of p and q

//then let the BigInteger class generate the prime. The size of p and q

//is offset so that we can guarantee that p and q will not be too close

// to each other. This make guessing p and q by searching values next to

//the square root of n more difficult.

void generatepq()

try

q=new BigInteger(16 + 1, 20, new Random());


//20=prime_certainity

p=new BigInteger(16 - 1, 20, new Random());

//16=bitsize

myparent.jtaw.append("p ="+p+"\tq ="+q+"\n");

catch(Exception ex)

System.out.println("getpq: "+ex);

49
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

BigInteger generaten(BigInteger ptemp,BigInteger qtemp)

BigInteger ntemp = ptemp.multiply(qtemp);

return ntemp;

/*------------------------------------Generate e----------------------------------*/

BigInteger generatee(BigInteger ptemp,BigInteger qtemp,int bitsize)

BigInteger e = new BigInteger("0");


BigInteger phi_pq = qtemp.subtract(new BigInteger("1"));

phi_pq = phi_pq.multiply(ptemp.subtract(new BigInteger("1")));

int i = 0;

do

e = (new BigInteger(bitsize, 0, new Random())).setBit(0);

i = i + 1;

} while (i<100 && (e.gcd(phi_pq).compareTo (new BigInteger("1")) !=


0));

return e;

50
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

/*-------------------------------------Generate d------------------------------*/

BigInteger generated(BigInteger ptemp,BigInteger qtemp,BigInteger etemp)


{

BigInteger phi_pq = qtemp.subtract(new BigInteger("1"));

phi_pq = phi_pq.multiply(ptemp.subtract(new BigInteger("1")));

BigInteger d = etemp.modInverse(phi_pq);

return d;

/*---------------------------------encrypt msg-----------------------------------*/

//This is a little tricky because the user is allowed to choose

// the size of n. The value to be encrypted must be less than n.

// So first I find the bit size of n, then subract one, and that is the

// size of the message that I will encrypt at one time. This ensures

// the message chunk that is encrypted is smaller than n. I use a

// mask to take one chunk of message at a time. Then the chunk is

// encrypted and placed in the result c. During the next iteration

// the message is shifted right and the result is shifted left and combined

// with c. The encrypted chunk must be the same bit size as n so that no

// data is lost.

// Encryption is done using the modPow function provide by the BigInt class.

BigInteger encrypt(BigInteger m, BigInteger etemp, BigInteger ntemp)

51
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

BigInteger c, bitmask;

c = new BigInteger("0");

int i = 0;

bitmask = (new BigInteger("2")).pow (ntemp.bitLength() - 1).subtract(new


BigInteger("1"));

while (m.compareTo(bitmask) == 1)

c =m.and (bitmask).modPow (etemp,ntemp).shiftLeft

(i*ntemp.bitLength()).or (c);

m = m.shiftRight(ntemp.bitLength()-1);

i = i+1;

c = m.modPow(etemp,ntemp).shiftLeft(i*ntemp.bitLength()).or(c);

return c;

/*-----------------------------------------decrypt---------------------------------*/

//Decryption is done just as encryption above, only now the data is read in

// in chunks the same size as n, and the result, if correct, will be one bit

// less than the size of n (because that was the original chuck size).

BigInteger decrypt(BigInteger c, BigInteger dtemp, BigInteger ntemp)

52
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

BigInteger m, bitmask;

m = new BigInteger("0");

int i = 0;

bitmask = (new BigInteger("2")).pow (ntemp.bitLength()).subtract(new

BigInteger("1"));

while (c.compareTo(bitmask) == 1)

m = c.and(bitmask).modPow (dtemp,ntemp).shiftLeft(i*(ntemp.bitLength()-

1)).or(m);

c = c.shiftRight(ntemp.bitLength());

i = i+1;

m = c.modPow(dtemp,ntemp).shiftLeft(i*(ntemp.bitLength()-1)).or(m);

return m;

class frameclass implements ActionListener

JFrame jf = new JFrame("Third Party");

Label jl = new JLabel("THIRDPARTY RUNNING.....");

Button jb = new JButton("Stop");

void fmethod()

53
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

Container cp = jf.getContentPane();

cp.setLayout(null);

cp.add(jl);

cp.add(jb);

jl.reshape(50,50,300,40);

jb.reshape(100,150,100,30);

jf.validate();

jf.setSize(400,300);

jf.setVisible(true);

jb.addActionListener(this);

public void actionPerformed(ActionEvent ae)

if(ae.getSource() == jb)

System.exit(0);

public class thirdparty

JFrame jfw;

static JTextArea jtaw;

54
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

thirdparty()

try

//detailwindow();

jfw = new JFrame("Details..");

Container cpw = jfw.getContentPane();

cpw.setLayout(null);

JLabel jlw = new JLabel("signature generation details :");

cpw.add(jlw);

jlw.reshape(20,20,250,30);

jtaw = new JTextArea();

JScrollPane jspw = new JScrollPane(jtaw);

cpw.add(jspw);

jspw.reshape(20,80,350,300);

jtaw.setEditable(false);

jfw.validate();

jfw.setSize(500,500);

jfw.setVisible(true);

ServerSocket ss=new ServerSocket(7868);

while(true)

System.out.println("waiting");

Socket insocket1 = ss.accept();

55
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

System.out.println("connected");

thirdpartyprocess g1=new thirdpartyprocess(insocket1,this);

catch(Exception e)

System.out.println("UHE");

public static void main(String args[]) throws Exception

frameclass f=new frameclass();

f.fmethod();

thirdparty t=new thirdparty();

Receiver Module
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)

//GEN-FIRST:event_jButton1ActionPerformed

if(evt.getSource()==jButton1)

String uname=jTextField1.getText();

String pass=jPasswordField1.getText();

56
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

String gid=jComboBox1.getSelectedItem().toString();

try

Socket s=new Socket("localhost",7777);

BufferedReader in1=new BufferedReader(new


InputStreamReader(s.getInputStream()));

while(true)

readcnt=in1.read(chstr);

if(readcnt <=0)

continue;

else

break;

catch(Exception e)

String instring = new String(chstr, 0, readcnt);

System.out.println(instring);

StringTokenizer st = new StringTokenizer(instring,"^");

Vector v = new Vector();

while(st.hasMoreTokens())

57
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

v.add(st.nextToken());

if(uname.equals("admin"))

user = v.get(0).toString();

BigInteger n1 = new BigInteger(v.get(1).toString());

BigInteger n2 = new BigInteger(v.get(2).toString());

BigInteger n3 = new BigInteger(v.get(3).toString());

BigInteger d1 = new BigInteger(v.get(4).toString());

BigInteger d2 = new BigInteger(v.get(5).toString());

BigInteger d3 = new BigInteger(v.get(6).toString());

BigInteger cypher = new BigInteger(v.get(7).toString());

BigInteger r3 = decrypt(cypher,d3,n3);

BigInteger r2 = decrypt(r3,d2,n2);

BigInteger r1 = decrypt(r2,d1,n1);

System.out.println("r1:"+r1+" r2:"+r2+" r3:"+r3);

byte b[] = r1.toByteArray();

jTextArea1.setText(new String(b));

else

try

connect();

58
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

pst = con.prepareStatement("select pass from receiver where groupid


=? and usrid =? ");

pst.setString(1,gid);

pst.setString(2,uname);

rs = pst.executeQuery();

int k = 0;

if(rs.next())

if(pass.equals(rs.getString("pass")))

k = 1;

System.out.println("hi");

StringBuffer sb = null;

if(k == 1)

pst = con.prepareStatement("select * from msg where receiverid =? and


receivergid =? ");

pst.setString(1,uname);

pst.setString(2,gid);

ResultSet rs3 = pst.executeQuery();

System.out.println("hi");

BigInteger n = null, d = null, msg = null;

int i=0;

while(rs3.next())

59
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

int l=0;

jTextArea1.setText("");

msg = new BigInteger(rs3.getString(5));

n = new BigInteger(rs3.getString(6));

d = new BigInteger(rs3.getString(7));

BigInteger r3 = decrypt(msg,d,n);

byte b[] = r3.toByteArray();


jTextArea1.setText(new String(b));

else
JOptionPane.showMessageDialog(null,"InvalidPassword","info",1);

catch(Exception e)

System.out.println(e);

}//GEN-LAST:event_jButton1ActionPerformed

public void connect()

60
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Con = DriverManager.getConnection("jdbc:odbc:multi");

catch(Exception e)

/**

* @param args the command line arguments

*/

public static void main(String args[])

java.awt.EventQueue.invokeLater(new Runnable()

public void run()

new Receive().setVisible(true);

BigInteger decrypt(BigInteger c, BigInteger dtemp, BigInteger ntemp)

61
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

BigInteger m, bitmask;

m = new BigInteger("0");

int i = 0;

bitmask = (new BigInteger("2")).pow(ntemp.bitLength()).subtract(new

BigInteger("1"));

while (c.compareTo(bitmask) == 1)

m = c.and(bitmask).modPow(dtemp,ntemp).shiftLeft(i*(ntemp.bitLength()-

1)).or(m);

c = c.shiftRight(ntemp.bitLength());

i = i+1;

m = c.modPow(dtemp,ntemp).shiftLeft(i*(ntemp.bitLength()-1)).or(m);

return m;

62
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 10
TESTING
10.1 UNIT TESTING

Software testing is critical element of software quality assurance and


represents ultimate review of specification, design and coding. Test case
design focuses on a set of technique for the creation of test cases that meet
overall testing objectives. Planning and testing of a programming system
involve formulating a set of test cases, which are similar to the real data that
the system is intended to manipulate. Test cases consist of input
specifications, a description of the system functions exercised by the input
and a statement of the extended output. Through testing involves producing
cases to ensure that the program responds, as expected, to both valid and
invalid inputs, that the program perform to specification and that it does not
corrupt other programs or data in the system.
In principle, testing of a program must be extensive. Every statement
in the program should be exercised and every possible path combination
through the program should be executed at least once. Thus, it is necessary
to select a subset of the possible test cases and conjecture that this subset
will adequately test the program.

63
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

10.2 INTEGRATION TESTING

It involves the testing of the order in which the different modules are
combined to produce the functioning whole. Integration testing generally
throws light on the order of arrangement of units, modules, systems,
subsystems and the entire product. The proposed system, “ the client server
architecture “ inherits a bottom-up integration strategy in which all the
subsystem and the modules involved in it are independently tested and
integrated to from the entire system, which is then tested as a whole.
For the testing of this system it was required that the software be
tested for performing its basic functions that are as follows: -
Start the server first and then client, then there is no error. Start the server
and client, and then stop the server and a send a message from client. The
error is no server connection. Start client first, then the error is client is not
connected to the server.

10.3 VALIDATION TESTING


Validation testing is used to validate the correct user name and
password and card number and pin number and if person gives the invalid
username and password, at that time the card validation does not execute.

10.4 PERFORMANCE TESTING


Performance testing determines the amount of execution thime spent
in various parts of the unit, program throughput, response time and device
utilization by the program unit.

64
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

TEST DATA TABLE


LOGIN : ADMINLOGIN

Authenti- Main Details Receiver


cation Frame Side

USER1 RECEIVER sender^group1^admin^group2^admin^hello SELECT


message from sender
LOGIN GROUP? sender is admin
RECEIVER
Group2 p=17387 q=67481 GROUP:
USERNAME n1=1173292147 group2
: admin USER? e1=47731
PASSWORD admin d1=613751771 ENTER
p=18979 q=66491
: system n2=1261932689
USERNAME:
MESSAGE: e2=35149 d2=1027600069 admin
USER2 hello p=17449 q=84143
LOGIN n3=1468211207 ENTER
e3=65311 d3=654109135 PASSWORD
SEND p=26189 q=85619
USERNAME n4=2242275991 system2
: user1 e4=63841 d4=916027729
PASSWORD Msg=448378203247
: user1 s1=57977171130529114
s2=1248857614252647091
s3=5026714486095450749
USER3 s4=cypher=19788535774630773748
LOGIN Message saved to database

USERNAME receiver^group2^admin
: user2 message from receiver VIEW
receiver is admin
PASSWORD checking for messages in database MESSAGE:
: user2 one message found
cypher=19788535774630773748 hello
USER4 s4=5026714486095450749
s3=1248857614252647091
LOGIN
s2=57977171130529114
s1=448378203247
USERNAME msg=hello
: user4 message sent to receiver
PASSWORD
: user4

LOGIN

65
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

LOGIN : USERLOGIN

Authentic Main Details Receiver


ation Frame Side

USERNAME RECEIVER sender^group1^user1^group2^user1^pesit SELECT


message from sender
: user1 GROUP? sender is user
RECEIVER
Group2 p=16547 q=95317 GROUP:
PASSWORD n=1577210399 group2
: user1 USER? e=48821
Admin d=125241413 ENTER
msg=482738399604
SUBMIT cypher=2744449612006375104
USERNAME:
MESSAGE cypher saved in database user1
:
Pesit ENTER
PASSWORD:
SEND user1

receiver^group2^user1
message from receiver VIEW
receiver is a user MESSAGE
checking for messages in database
one message found
cypher=2744449612006375104 Pesit
n=1577210399
d=125241413
msg=pesit
msg sent to receiver

66
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 11
SCREEN SHOTS

67
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

68
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

69
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

70
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

71
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 12
CONCLUSION

This project helps us in implementing many important features.


Properties of this scheme include correctness, threshold property, traceability
and coalition resistance .These properties enhance the attractiveness of the
above defined scheme.

All the security requirements needed are satisfied because of the strong
break-resistance. The threshold multisignature scheme remains secure even if
the threshold cryptosystem has been broken. This provides a huge advantage.

The group secret or individual secret shares are known or controlled by


an adversary. This centralized entity is highly secure. Hence, it reduces the
amount of load on the sender and the receiver. All the messages are stored in
this adversary and retrieved from the same place.

This scheme has been designed to deal with the latest attacks of
threshold signature scheme by using a traceability feature. Also the scheme is
a order sensitive .The decryption has to be performed in the same order as
the encryption. This further improves security.

Hence it can be concluded that Threshold Multi-Signature scheme deals


with many of the drawbacks of RSA algorithm and has a great future.

72
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 13
FUTURE ENHANCEMENTS

The project has been implemented for one group on the senders end. It can
be implemented for many groups and thus made more real time. In order to
enhance the already existing features we can try to implement a backup of
the third party on another system. If the existing system fails the other
system can immediately take control thus providing a good real time network.
It helps in dealing with crashes and other such related issues.

The project has been developed for one user to send a message to one user
only and for a group to send message to a group. We can take it to the next
level where a message can be sent from one user to multiple users and from
one group to one or more users.

Also we don’t have the option to include new users in our project. This feature
can be implemented to make the system more real time.

Our project can also be used to implement a safe delivery in group


communication systems. It is being implemented in large scale voting
electronic scheme. It is also used for facsimile mail service. These products
are making a huge head way in the market.

73
Department of CSE Jan’10 – Apr’10 HMRITM
MAJOR PROJECT: “DIRECTED THRESHOLD – MULTISIGNATURE SCHEME”

CHAPTER 14
BIBLIOGRAPHY
[1] Boyar, J., Chaum D., Damgard I. and Pederson T., (1991), Convertible
undeniable signatures. Advances in Cryptology – Crypto, 90, LNCS #
537,p.p.189-205.

[2] Chaum D. (1991). Zero- knowledge undeniable signatures. Advances in


Cryptology –Eurocrypt, 90, LNCS # 473,p.p.458-464.

[3] Chaum D. (1995). Designated confirmer signatures, Advances in


Cryptology Eurocrypt, 94 LNCS # 950,p.p.86-91.

[4] Diffie W. and Hellman M. (1976), New directions in Cryptography, IEEE


Trans.Info.Theory.31.pp. 644 - 654.

[5] Desmedt, Y. (1988). Society and group oriented cryptography. In


Advances in Cryptology –Crypto -87, Proceedings. p.p. 457-469. New York:
Springer Verlag.

[6] Shamir A. (1979). How to share a secret, communications of the ACM, 22:
p.p. 612 -613.

[7] Schnorr C.P. (1994). Efficient signature generation by smart cards,


Journal of Cryptology, 4(3), p.p.161-174.

74
Department of CSE Jan’10 – Apr’10 HMRITM

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