Java supports encryption by a wide variety of packages: The standard java.security package The standard javax.crypto package Packages supplied by third.

Slides:



Advertisements
Similar presentations
Encipherment Using Modern Symmetric-Key Ciphers. 8.2 Objectives ❏ To show how modern standard ciphers, such as DES or AES, can be used to encipher long.
Advertisements

Modern Symmetric-Key Ciphers
Copyright © 2005 David M. Wheeler, All Rights Reserved Desert Code Camp: Introduction to Cryptography David M. Wheeler May 6 th 2006 Phoenix, Arizona.
Computer Science 101 Data Encryption And Computer Networks.
Cryptography & The JCE Presented by Geoff Whittington, Fireball Technology Group.
Public Key Encryption Algorithm
CS255 Programming Assignment #1. Due: Friday Feb 10 th (11:59pm) –Can use extension days Can work in pairs –One solution per pair Test and submit on Sweet.
The Java Crypto API ICW Lecture 3 Tom Chothia. Reminder of Last Time: Your programs defines “Classes”. Each class defines “Objects”. An Object is defined.
McGraw-Hill©The McGraw-Hill Companies, Inc., Security PART VII.
CS470, A.SelcukModes of Operation1 Encrypting with Block Ciphers CS 470 Introduction to Applied Cryptography Instructor: Ali Aydin Selcuk.
Network Security Chapter
Csci5931 Web Security1 GS: Chapter 4 Symmetric Encryption in Java.
Csci5233 Computer Security1 GS: Chapter 5 Asymmetric Encryption in Java.
IS 302: Information Security and Trust Week 2: Encryption Basics 2012.
1 Homework Study Java Cryptography by Reading the rest of slides and accessing Sun ’ s Java website:
What is Encryption? - The translation of data into a secret code - To read an encrypted file, you must have access to a secret key or password that enables.
Hybrid Cipher encryption Plain Text Key Cipher Text Key Plain Text IV Hybrid Cipher decryption Hybrid Cipher Note: IV used in encryption is not used in.
CS255 Programming Project 1. Programming Project 1 Due: Friday Feb 8 th (11:59pm)‏ – Can use extension days Can work in pairs – One solution per pair.
Lecture 3: Cryptographic Tools modified from slides of Lawrie Brown.
1 Fluency with Information Technology Lawrence Snyder Chapter 17 Privacy & Digital Security Encryption.
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 ( 李德成 )
Dr. Khalid A. Kaabneh Amman Arab University
Security.  is one of the most widely used and regarded network services  currently message contents are not secure may be inspected either.
Chapter 20 Symmetric Encryption and Message Confidentiality.
Day 18. Concepts Plaintext: the original message Ciphertext: the transformed message Encryption: transformation of plaintext into ciphertext Decryption:
Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret.
Chapter 20 Symmetric Encryption and Message Confidentiality.
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.
Introduction to cryptography by konrad. Introduction to cryptography Cryptography is the process of encrypting/decrypting data streams using some E(M)/D(M)
Advanced Windows 8 Apps Using JavaScript Jump Start Exam Prep M5: Data, Files, and Encryption Michael Palermo Microsoft Technical Evangelist Jeremy.
Cryptography Team Presentation 2
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
BLOCK CIPHER SYSTEMS OPERATION MODES OF DATA ENCRYPTION STANDARD (DES)
Computer Network Lab. Encryption 컴퓨터 네트워크 실험실 조한진 / 이희규.
Modes of Usage Dan Fleck CS 469: Security Engineering These slides are modified with permission from Bill Young (Univ of Texas) 11 Coming up: Modes of.
Confidentiality Confidentiality is maintained so long as private keys are secure. Authenticity is possible via public-key encryption by encrypting messages.
Basic Cryptography Some examples taken from “Coding Theory and Cryptography, the essentials” Second Edition Hankerson, et.al. 2000, Marcel Dekker, Inc.
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.
Encryption No. 1  Seattle Pacific University Encryption: Protecting Your Data While in Transit Kevin Bolding Electrical Engineering Seattle Pacific University.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Announcements Final exam test dates. December 11 through 18. Presentations Hash Function If there are problems associated with taking the final exam,
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
1 Session 3 Module 4: Java Security Module 5: Cryptography.
Computer Science 320 Massive Parallelism. Example Problem: Breaking a Cipher Somehow obtain a sample plaintext and its ciphertext Then search for the.
A Java implemented key collision attack on the Data Encryption Standard (DES) John Loughran, Tom Dowling NUI, Maynooth, Co. Kildare, Ireland PPPJ ‘03.
CRYPTOGRAPHY PRESENTED BY : NILAY JAYSWAL BRANCH : COMPUTER SCIENCE & ENGINEERING ENTRY NO. : 14BCS033 1.
Cryptology aka Cryptography Tim Cahill Ryan Church.
Homework #1 J. H. Wang Oct. 2, 2013.
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.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Cipher Transmission and Storage Modes Part 2: Stream Cipher Modes CSCI 5857: Encoding and Encryption.
Block Ciphers and the Data Encryption Standard. Modern Block Ciphers  One of the most widely used types of cryptographic algorithms  Used in symmetric.
CSCI 391: Practical Cryptology Introduction. Definitions Digital encryption techniques are used to protect data in two ways: to maintain privacy and to.
Java Cryptography Nick Pullman DSU-MSIA Citigroup Information Security
LAB#6 MAC & MASSAGE DIGEST CPIT 425. Message Authentication 2  Message authentication is a mechanism used to verify the integrity of a message.  Message.
“Java Cryptography” By Karim Kilany CSCI 485 Presentation Dr.Sherif Aly.
LAB#4 PROGRAMMING USING JAVA CRYPTOGRAPHIC LIBRARIES CPIT 425.
Information and Computer Security CPIS 312 Lab 9
Java Assignment Related
Lab#7 Digital signature Cpit 425
Digital Signatures Assignment
One-way Encryption Ideal Properties
One-way Encryption Properties
GS: Chapter 4 Symmetric Encryption in Java
Block cipher and modes of encryptions
Assignment 2 DES implementation.
Presentation transcript:

Java supports encryption by a wide variety of packages: The standard java.security package The standard javax.crypto package Packages supplied by third parties copy jar files onto your machine & include in CLASSPATH # List of providers and their preference orders (see above): # security.provider.1=sun.security.provider.Sun security.provider.2=com.apple.crypto.provider.Apple... security.provider.8=org.bouncycastle.jce.provider.BouncyCastleProvider Edit the java.security file to include the provider. setenv CLASSPATH.:/Users/driley/Library/bcprov-jdk jar For Java 1.4 though 1.7 the SunJCE is a built-in provider.

Two Steps for generating a new key (or pair) 1) Create generator key/pair by calling a static method named getInstance ). 2) Call generateKey object, passing a random number. The Java encryption packages include classes that are useful for generating keys. java.security.Key javax.crypto.KeyGenerator java.security.KeyPair java.security.KeyPairGenerator java.security.SecureRandom Sample Symmetric Code KeyGenerator generator = KeyGenerator.getInstance(“DESede”); 1) Key key = generator.generateKey(); generator.init(new SecureRandom()); 2) Sample Public-key Code KeyPairGenerator generator = KeyPairGenerator.getInstance(“RSA”); 1) KeyPair keyPair = generator.generateKeyPair(); generator.initialize(2048, new SecureRandom()); 2)

Four Steps for encrypting/decrypting 3) Fill a byte array from plaintext to be encrypted (or ciphertext to be decrypted). 4) Call doFinal on the object, passing the byte array; this returns the result of encrypting/decrypting. 1) Create an encrypting object using javax.crypto.Cipher. (This is done by calling a static method named getInstance ). 2) Call init on the Cipher object, passing the key & setting the mode to encrypt/decrypt. getInstance specifies algorithm via 1st argument String Algorithm/ChainingMode/Padding getInstance specifies supplier via second (optional) argument

Four Steps for encrypting/decrypting 3) Fill a byte array from plaintext to be encrypted (or ciphertext to be decrypted). 4) Call doFinal on the object, passing the byte array; this returns the result of encrypting/decrypting. 1) Create an encrypting object using javax.crypto.Cipher. (This is done by calling a static method named getInstance ). 2) Call init on the Cipher object, passing the key & setting the mode to encrypt/decrypt. Symmetric Sample Cipher encoder = Cipher.getInstance(“DESede/ECB/PKCS5Padding”); 1) encoder.init(Cipher.ENCRYPT_MODE, key); 2) byte[] buffer = getPlaintext(); 3) byte[] encodedMsg = encoder.doFinal(buffer); 4) Cipher decoder = Cipher.getInstance(“DESede/ECB/PKCS5Padding”); 1) decoder.init(Cipher.DECRYPT_MODE, key); 2) byte[] buffer = getCiphertext(); 3) byte[] decodedMsg = decoder.doFinal(buffer); 4) must be encoder.getBlockSize() or smaller

Four Steps for encrypting/decrypting 3) Fill a byte array from plaintext too be encrypted (or ciphertext to be decrypted). 4) Call doFinal on the object, passing the byte array; this returns the result of encrypting/decrypting. 1) Create an encrypting object using javax.crypto.Cipher. (This is done by calling a static method named getInstance ). 2) Call init on the Cipher object, passing the key & setting the mode to encrypt/decrypt. Public-key Sample Cipher encoder = Cipher.getInstance(“RSA/NONE/PKCS1Padding”, “BC”); 1) encoder.init(Cipher.ENCRYPT_MODE, keyPair.getPublic()); 2) byte[] buffer = getPlaintext(); 3) byte[] encodedMsg = encoder.doFinal(buffer); 4) must be encoder.getBlockSize() == 0