Lab#7 Digital signature Cpit 425

Slides:



Advertisements
Similar presentations
Public Key Infrastructure and Applications
Advertisements

Hash Functions A hash function takes data of arbitrary size and returns a value in a fixed range. If you compute the hash of the same data at different.
Network Security: Lab#2 J. H. Wang Apr. 28, 2011.
Java Security Model Lab#1 I. Omaima Al-Matrafi. Safety features built into the JVM Type-safe reference casting Structured memory access (no pointer arithmetic)
CSE 597E Fall 2001 PennState University1 Digital Signature Schemes Presented By: Munaiza Matin.
Overview of Digital Signatures Introduction To Networks and Communications (CS 555) Presented by Bharath Kongara.
Encryption Methods By: Michael A. Scott
1 Homework Study Java Cryptography by Reading the rest of slides and accessing Sun ’ s Java website:
Digital Signature Xiaoyan Guo/ Xiaohang Luo/
INTRODUCTION Why Signatures? A uthenticates who created a document Adds formality and finality In many cases, required by law or rule Digital Signatures.
Chapter 13 Digital Signature
Csci5233 Computer Security1 GS: Chapter 6 Using Java Cryptography for Authentication.
Java and Security Cryptography, Symmetric Key, Public Key, Authentication, Digital Signatures, Message Digests.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Bob can sign a message using a digital signature generation algorithm
DSA (Digital Signature Algorithm) Tahani Aljehani.
CS555Topic 211 Cryptography CS 555 Topic 21: Digital Schemes (1)
Electronic Mail Security
XML Signature Prabath Siriwardena Director, Security Architecture.
4 th lecture.  Message to be encrypted: HELLO  Key: XMCKL H E L L O message 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) message + 23 (X) 12 (M) 2 (C) 10 (K) 11.
Lecture 8 Overview. Secure Hash Algorithm (SHA) SHA SHA SHA – SHA-224, SHA-256, SHA-384, SHA-512 SHA-1 A message composed of b bits.
Advanced Database Course (ESED5204) Eng. Hanan Alyazji University of Palestine Software Engineering Department.
1 Number Theory and Advanced Cryptography 6. Digital Signature Chih-Hung Wang Sept Part I: Introduction to Number Theory Part II: Advanced Cryptography.
Pretty Good Privacy (PGP) Security for Electronic .
COMPS311F Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
What is Digital Signature A digital signature is a bit of stream through which many things like verification of origin of document,the identity of the.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Java Security Session 19. Java Security / 2 of 23 Objectives Discuss Java cryptography Explain the Java Security Model Discuss each of the components.
1 Session 4 Module 6: Digital signatures. Digital Signatures / Session4 / 2 of 18 Module 4, 5 - Review (1)  Java 2 security model provides a consistent.
Computer Science and Engineering Computer System Security CSE 5339/7339 Lecture 11 September 23, 2004.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Electronic Mail Security Prepared by Dr. Lamiaa Elshenawy
DIGITAL SIGNATURE(DS) IN VIDEO. Contents  What is Digital Signature(DS)?  General Signature Vs. Digital Signatures  How DS is Different from Encryption?
Network Security: Lab#2 J. H. Wang Oct. 9, Objectives To learn to use message digests –MD5 To learn to use secure hash functions –SHA-1, SHA-2 To.
LAB#8 PKI & DIGITAL CERTIFICATE CPIT 425. Public Key Infrastructure PKI 2  Public key infrastructure is the term used to describe the laws, policies,
LAB#6 MAC & MASSAGE DIGEST CPIT 425. Message Authentication 2  Message authentication is a mechanism used to verify the integrity of a message.  Message.
PRESENTATION ON SECURE SOCKET LAYER (SSL) BY: ARZOO THAKUR M.E. C.S.E (REGULAR) BATCH
LAB#4 PROGRAMMING USING JAVA CRYPTOGRAPHIC LIBRARIES CPIT 425.
Lecture 8 (Chapter 18) Electronic Mail Security Prepared by Dr. Lamiaa M. Elshenawy 1.
Security Depart. of Computer Science and Engineering 刘胜利 ( Liu Shengli) Tel:
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 14. Digital signature.
1 Project 12: Cars from File. This is an extension of Project 11, Car Class You may use the posted solution for Project 11 as a starting point for this.
Information and Computer Security CPIS 312 Lab 9
Java Assignment Related
JAVA MULTIPLE CHOICE QUESTION.
Unit 3 Section 6.4: Internet Security
3 Introduction to Classes and Objects.
Digital Signatures Assignment
Computer Communication & Networks
Network Security Unit-III
e-Health Platform End 2 End encryption
B. R. Chandavarkar CSE Dept., NITK Surathkal
Introduction Used for communication to verify
Encryption
NET 311 Information Security
Introduction to javadoc
Cryptography in .Net CS 795.
Pooja programmer,cse department
Security in Network Communications
ELECTRONIC MAIL SECURITY
ELECTRONIC MAIL SECURITY
The Secure Sockets Layer (SSL) Protocol
Digital Signatures…!.
Best Digital Signature Service in Noida. Electronic Record 1.Very easy to make copies 2.Very fast distribution 3.Easy archiving and retrieval 4.Copies.
Lecture 5: Functions and Parameters
Introduction to javadoc
Chapter -8 Digital Signatures
Chapter 13 Digital Signature
Chapter 3 - Public-Key Cryptography & Authentication
Digital Signature Standard (DSS)
Presentation transcript:

Lab#7 Digital signature Cpit 425

Digital Signature A digital signature is an electronic signature that can be used to authenticate the identity of the sender of a message or the signer of a document, and possibly to ensure that the original content of the message or document that has been sent is unchanged.

Digital Signature

Algorithms Used in Digital signature DSA was supported in older Java (v1.2); RSA is supported by JDK v1.3 and higher. RSA is generally recommended if you have a choice. The DSA algorithm using the SHA-1 hash algorithm can be specified as SHA1withDSA. In the case of RSA, there are multiple choices for the hash algorithm, so the signing algorithm could be specified as, for example, MD2withRSA, MD5withRSA, or SHA1withRSA. The algorithm name must be specified, as there is no default.

Digital Signature in Java Digital Signature is essentially a message digest signed by someone’s private key. Java Package: java.security Java Class :Signature Methods: getInstance( ), initSign( ), initVerify( ), update( ), sign( ), and verify()

Digital Signature in Java There are four phases to use a Signature object: Defining and Creation : a cipher object is created by invoking the static method getInstance(). Ex: Signature sig = Signature.getInstance("MD5WithRSA"); Initialization, with either: a public key, which initializes the signature for verification then initVerify(PublicKey) will be used, or a private key, which initializes the signature for signing then initSign(PrivateKey) will be used. Ex: sig.initVerify(keyPair.getPublic()); OR sig.initSign(keyPair.getPrivate());

Digital Signature in Java Updating: Depending on the type of initialization, update( ) method will update or Prepare the bytes to be signed or verified. Ex: sig.update(data); // data is byte array used in signing or verifying Signing or Verifying a signature on all updated bytes using the sign( ) or verify( ) method. byte[] signatureBytes = sig.sign(); ... boolean verified = sig.verify(signatureBytes);

Digital Signature in Java Method header Return data type  initSign(PrivateKey privateKey)           Initialize this object for signing void initVerify(PublicKey publicKey)           Initializes this object for verification. sign()           Returns the signature bytes of all the data updated. byte[] verify(byte[] signature)           Verifies the passed-in signature.  boolean update(byte[] data)           Updates the data to be signed or verified, using the specified array of bytes.

Lab Work Write a program that implements a digital signature using a Signature class. The program should creates an RSA key pair and then signs any text and displays the signature. Finally, verify the signature with the corresponding public key.

Homework#4 First: Generating a Digital Signature 1. Prepare Initial Program Structure Create a java file named GenSig.java. Type in the initial program structure (import statements, class name, main method, and so on. 2. Generate Public and Private Keys Generate a key pair (public key and private key using “DSA” algorithm). The private key is needed for signing the data. The public key will be used by the VerSig program for verifying the signature. 3. Sign the Data Create a Signature object (using “SHA1withDSA” as the algorithm) and initialize it for signing. Supply it with the data (read data from a file input.txt) to be signed, and generate the signature. 4. Save the Signature and the Public Key in Files Save the signature bytes in one file (sign.txt) and the public key bytes in another (public.txt) 5. Compile and Run the Program

Homework#4 Second: Verifying a Digital Signature The steps to create the VerSig.java sample program to import the files and to verify the signature are the following: 1. Prepare Initial Program Structure: Create a java file named VerSig.java Type in the initial program structure (import statements, class name, main method, and so on). 2. Input and Convert the Encoded Public Key Bytes: Import the encoded public key bytes from the file (public.txt) and convert them to a PublicKey. 3. Input the Signature Bytes: From sign.txt 4. Verify the Signature: Get a Signature object (using “SHA1withDSA” algorithm) and initialize it with the public key for verifying the signature. Supply it with the data whose signature is to be verified , and verify the signature. 5.Compile and Run the Program: the out put screen should show if the signature verified or not.

Homework#4 Sample output: What to submit: Due date: Hard copy and soft copy (in CD) of: GenSig.java VerSig.java The out put screen Due date: for Sunday section: 25/5/1431 for Tuesday section: 27/5/1431