Commonly Written Communication - MAC and the sender S Side



Similar documents
Security. Contents. S Wireless Personal, Local, Metropolitan, and Wide Area Networks 1

Message Authentication Codes

Network Security. Computer Networking Lecture 08. March 19, HKU SPACE Community College. HKU SPACE CC CN Lecture 08 1/23

Savitribai Phule Pune University

Properties of Secure Network Communication

Chapter 11 Security+ Guide to Network Security Fundamentals, Third Edition Basic Cryptography

Computer Networks 1 (Mạng Máy Tính 1) Lectured by: Dr. Phạm Trần Vũ MEng. Nguyễn CaoĐạt

Common security requirements Basic security tools. Example. Secret-key cryptography Public-key cryptography. Online shopping with Amazon

CSE/EE 461 Lecture 23

Overview. SSL Cryptography Overview CHAPTER 1

Network Security Technology Network Management

Chapter 7 Transport-Level Security

Network Security. Security Attacks. Normal flow: Interruption: 孫 宏 民 Phone: 國 立 清 華 大 學 資 訊 工 程 系 資 訊 安 全 實 驗 室

Ky Vu DeVry University, Atlanta Georgia College of Arts & Science

Designing Hash functions. Reviewing... Message Authentication Codes. and message authentication codes. We have seen how to authenticate messages:

Cryptography and Network Security Chapter 12

TELE 301 Network Management. Lecture 18: Network Security

Chapter 6 Electronic Mail Security

Practice Questions. CS161 Computer Security, Fall 2008

Network Security - Secure upper layer protocols - Background. Security. Question from last lecture: What s a birthday attack? Dr.

Principles of Network Security

Computer Networks. Network Security 1. Professor Richard Harris School of Engineering and Advanced Technology

The Secure Sockets Layer (SSL)

Lecture 9: Application of Cryptography

Network Security Protocols

Cryptography and Network Security Chapter 14. Key Distribution. Key Management and Distribution. Key Distribution Task 4/19/2010

CSC474/574 - Information Systems Security: Homework1 Solutions Sketch

Chapter 10. Cloud Security Mechanisms

Overview of Cryptographic Tools for Data Security. Murat Kantarcioglu

Network Security (2) CPSC 441 Department of Computer Science University of Calgary

How To Understand And Understand The Ssl Protocol ( And Its Security Features (Protocol)

Security Sensor Network. Biswajit panja

Chapter 10. Network Security

Content Teaching Academy at James Madison University

Cryptography and Network Security Chapter 14

MACs Message authentication and integrity. Table of contents

Overview of CSS SSL. SSL Cryptography Overview CHAPTER

Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2010

How encryption works to provide confidentiality. How hashing works to provide integrity. How digital signatures work to provide authenticity and

Authentication requirement Authentication function MAC Hash function Security of

Chapter 7: Network security

Information Security

First Semester Examinations 2011/12 INTERNET PRINCIPLES

OOo Digital Signatures. Malte Timmermann Technical Architect Sun Microsystems GmbH

CS 758: Cryptography / Network Security

Message Authentication Codes. Lecture Outline

As enterprises conduct more and more

Network Security. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross 8-1

AC76/AT76 CRYPTOGRAPHY & NETWORK SECURITY DEC 2014

Authenticated Encryption: Relations among Notions and Analysis of the Generic Composition Paradigm By Mihir Bellare and Chanathip Namprempre

Symmetric Key cryptosystem

Safeguarding Data Using Encryption. Matthew Scholl & Andrew Regenscheid Computer Security Division, ITL, NIST

Efficient Framework for Deploying Information in Cloud Virtual Datacenters with Cryptography Algorithms

Cryptography and Network Security Chapter 15

Compter Networks Chapter 9: Network Security

Security in Distributed Systems. Network Security

Network Security [2] Plain text Encryption algorithm Public and private key pair Cipher text Decryption algorithm. See next slide

Developing and Investigation of a New Technique Combining Message Authentication and Encryption

Transport Level Security

Lukasz Pater CMMS Administrator and Developer

Client Server Registration Protocol

CS377: Database Systems Data Security and Privacy. Li Xiong Department of Mathematics and Computer Science Emory University

12/3/08. Security in Wireless LANs and Mobile Networks. Wireless Magnifies Exposure Vulnerability. Mobility Makes it Difficult to Establish Trust

Chapter 17. Transport-Level Security

CRYPTOGRAPHY IN NETWORK SECURITY

1. a. Define the properties of a one-way hash function. (6 marks)

Network Security CS 5490/6490 Fall 2015 Lecture Notes 8/26/2015

Guideline for Implementing Cryptography In the Federal Government

Page 1. Lecture 1: Introduction to. Introduction to Computer Networks Security. Input file DES DES DES DES. Output file

Cryptography & Network Security. Introduction. Chester Rebeiro IIT Madras

Transitions: Recommendation for Transitioning the Use of Cryptographic Algorithms and Key Lengths

TIME SCHEDULE. 1 Introduction to Computer Security & Cryptography 13

Cryptography and Network Security Chapter 11. Fourth Edition by William Stallings

CS 348: Computer Networks. - Security; 30 th - 31 st Oct Instructor: Sridhar Iyer IIT Bombay

EDA385 Embedded Systems Design. Advanced Course

Cryptography and Network Security

Schnorr Signcryption. Combining public key encryption with Schnorr digital signature. Laura Savu, University of Bucharest, Romania

Wireless LAN Security Mechanisms

Cyber Security Workshop Encryption Reference Manual

Lecture Objectives. Lecture 8 Mobile Networks: Security in Wireless LANs and Mobile Networks. Agenda. References

SSO Eurécia. and external Applications. Purpose

Overview of Symmetric Encryption

Network Security. Gaurav Naik Gus Anderson. College of Engineering. Drexel University, Philadelphia, PA. Drexel University. College of Engineering

SSL A discussion of the Secure Socket Layer

Cryptographic hash functions and MACs Solved Exercises for Cryptographic Hash Functions and MACs

SECURITY IN NETWORKS

How To Understand And Understand The History Of Cryptography

AN IMPLEMENTATION OF HYBRID ENCRYPTION-DECRYPTION (RSA WITH AES AND SHA256) FOR USE IN DATA EXCHANGE BETWEEN CLIENT APPLICATIONS AND WEB SERVICES

NXP & Security Innovation Encryption for ARM MCUs

Three attacks in SSL protocol and their solutions

Security. Friends and Enemies. Overview Plaintext Cryptography functions. Secret Key (DES) Symmetric Key

CHAPTER 4 DEPLOYMENT OF ESGC-PKC IN NON-COMMERCIAL E-COMMERCE APPLICATIONS

CIS 6930 Emerging Topics in Network Security. Topic 2. Network Security Primitives

Error oracle attacks and CBC encryption. Chris Mitchell ISG, RHUL

Chapter 8. Network Security

Overview/Questions. What is Cryptography? The Caesar Shift Cipher. CS101 Lecture 21: Overview of Cryptography

Network Security Essentials Chapter 5

A PPENDIX G S IMPLIFIED DES

Chapter 6 CDMA/802.11i

Transcription:

ROYAL INSTITUTE OF TECHNOLOGY Assignment Report Network Security IV2020 /ICSS Submitted By Vivek Agrawal (871231-7216) Group Details Chaitanya Pinnaka Vivek Agrawal December 20, 2010

1. Assignment Topic Message Integrity: One student will create and verify MAC and protect it using shared secret. The other student will create and verify MAC and protect it using private/public key pair. 2. Details of the selected protocol The details of the selected protocol can be derived from the Figure 1. At the sender s side MAC is created using a shared secret key (S). Here block (H) denotes the generation of MAC. MAC is encrypted using a symmetric key (K). Now the message is appended with the encrypted/protected MAC. Receiver receives the message in the form of message + encrypted MAC. Since the MAC is encrypted using the symmetric key (shared by only sender and receiver), so receiver will be able to decrypt the MAC successfully using secret key (K). The original message is then used to generate the MAC using same shared secret key (S) and then it is verified against the decrypted MAC. The receiver is assured that the message has not been changed. If an attacker alters the message but does not alter the MAC, then the receiver s calculation of the MAC will differ from the received MAC. Because the attacker is assumed not to know the secret key, the attacker cannot alter the MAC to correspond to the alterations in the message [1]. S S Figure 1: Creation and encryption of MAC at the sender s side and decryption and verification of MAC at receiver s side [3] 3. Individual implementation I am dealing with the creation and protection of MAC using symmetric key and this protected MAC is transmitted to the receiver with the original message. This program assumes that two communicating parties share a common secret key K. File plaintext.txt contains a message which is communicated from sender A to recipient B.

a. Sender s Side (Main.java) First step is to read the message from the plaintext.txt file and save the content in a variable [2]. // to read the plaintext/ message from a given file BufferedInputStream br = new BufferedInputStream(new FileInputStream("plaintext.txt")); while (br.available() > 0) { plaintextbytes = new byte[br.available()]; br.read(plaintextbytes); Now shared secret key will be generated in order to calculate the MAC of the message. // generation of shared secret key to generate MAC KeyGenerator keygen = KeyGenerator.getInstance("HmacMD5"); SecretKey mac_key = keygen.generatekey(); Mac mac = Mac.getInstance(mac_key.getAlgorithm()); mac.init(mac_key); The next step is to calculate MAC using the secret key. //creation of MAC byte[] temp_data = plaintextbytes; byte[] digest = mac.dofinal(temp_data); The above 3 steps can be summarized as [1]: MAC=C (K,M) Where M=Input Message C=MAC function K=shared secret key MAC=message authentication code This shared secret key is saved in a text file mac_key.txt and then symmetric key is calculated to protect the MAC. Symmetric key is calculated using DES algorithm. Symmetric key is also saved in a text file sym_key.txt. Mac is now protected using symmetric key. Encryption algorithm which is used to encrypt the MAC is DES/ECB. //initialization of Cipher Cipher c; c = Cipher.getInstance("DES/ECB/PKCS5Padding"); //Encryption of MAC c.init(cipher.encrypt_mode, sym_key); byte[] ciphertext = c.dofinal(digest);

System.out.println("protected MAC : " + ciphertext); BufferedOutputStream out_mac = new BufferedOutputStream(new FileOutputStream("protected_mac.txt")); out_mac.write(ciphertext); out_mac.flush(); out_mac.close(); Protected MAC is saved in the file protected_mac.txt. Sender will send the protected_mac.txt, plaintext.txt, Sym_key.txt, mac_key.txt files to the receiver. b. Receiver s Side (Verify_MAC.java) Receiver reads the protected MAC from the file protected_mac.txt and decrypts it using the symmetric key [2]. BufferedInputStream in_mac = new BufferedInputStream(new FileInputStream("protected_mac.txt")); byte[] ciphertext = new byte[in_mac.available()]; in_mac.read(ciphertext); in_mac.close(); //initialization of Cipher Cipher c; c = Cipher.getInstance("DES/ECB/PKCS5Padding"); //to extract the shared secret key for MAC BufferedInputStream in1 = new BufferedInputStream(new FileInputStream("Sym_key.txt")); byte[] keybytes = new byte[in1.available()]; in1.read(keybytes); in1.close(); SecretKeySpec sym_key = new SecretKeySpec(keyBytes, "DES"); //Deryption of MAC c.init(cipher.decrypt_mode, sym_key); byte[] plaintext = c.dofinal(ciphertext); Receiver then generates the MAC of the plaintext/message using the same algorithm and same shared secret key. //to read message from the file byte[] plaintextbytes = {}; BufferedInputStream br = new BufferedInputStream(new FileInputStream("plaintext.txt")); while (br.available() > 0) { plaintextbytes = new byte[br.available()]; br.read(plaintextbytes); } //to extract the shared secret key for MAC BufferedInputStream in = new BufferedInputStream(new FileInputStream("mac_key.txt")); byte[] keybytes1 = new byte[in.available()]; in.read(keybytes1);

in.close(); //calculation of MAC at recipient's end SecretKeySpec skeyspec = new SecretKeySpec(keyBytes1, "HmacMD5"); Mac mac = Mac.getInstance(skeySpec.getAlgorithm()); mac.init(skeyspec); byte[] utf8 = plaintextbytes; byte[] digest = mac.dofinal(utf8); If the newly generated MAC is similar to the decrypted MAC the receiver is assured that the message has not been altered. boolean mac_verify = true; for (int i = 0; i < plaintext.length; i++) { if (plaintext[i]!= digest[i]) { mac_verify = false; System.out.println("Message has been changed, so it cannot be authenticated."); break; } } if (mac_verify) { System.out.println("Message authenticated successfully."); }

4. Results a. Scenario 1 Original Message is : My name is vivek Agrawal. My password is KTH for the system. So at the sender s side the output of the code is: Figure 2: Creation and protection of MAC at the sender s side If the same message is transmitted to the receiver end then the output of the code is: Figure 3: Verification of MAC at the receiver s side

b. Scenario 2 Original Message is : My name is vivek Agrawal. My password is KTH for the system. So at the sender s side the output of the code is: Figure 4: Creation and protection of MAC at the sender s side Now the message has been altered by an attacker. The message received by the receiver is now: My name is Bill Gates. My password is KTH_Bill for the system. Output of the code at the receiver s side is: Figure 5: Verification of MAC at the receiver s side Since the message has been changed so the receiver will not get the same MAC and in this way it can be concluded that the original message has been changed.

5. Conclusion This assignment allows us to implement the message integrity feature using java. After conducting this assignment we are able to understand the logic /details of MAC clearly. 6. References 1. Stallings, William. Cryptography and Network Security Principles and Practices, Fourth Edition. s.l. : Prentice Hall, 2005. 2. Hook, David. Beginning Cryptography with Java. s.l. : Wiley Publishing, Inc., 2005. 3. Morgan, Matei Ciobanu. Lecture 4, Message Confidentiality and Integrity. 2010. Slide Number 32.