Java Assignment Related

Slides:



Advertisements
Similar presentations
Chapter 3 Public Key Cryptography and Message authentication.
Advertisements

Network Security: Lab#2 J. H. Wang Apr. 28, 2011.
Copyright © 2005 David M. Wheeler, All Rights Reserved Desert Code Camp: Introduction to Cryptography David M. Wheeler May 6 th 2006 Phoenix, Arizona.
Spring 2000CS 4611 Security Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls.
An Introduction to Secure Sockets Layer (SSL). Overview Types of encryption SSL History Design Goals Protocol Problems Competing Technologies.
Cryptography & The JCE Presented by Geoff Whittington, Fireball Technology Group.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
Implementing the Diffie -Hellman Key Agreement using Data Encryption Standard Presented by : Sahil Behl Muhammad Rehan Fayyaz Under the guidance of Dr.
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
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.
Chapter 3 Encryption Algorithms & Systems (Part C)
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
Csci5233 Computer Security1 GS: Chapter 5 Asymmetric Encryption in Java.
Key Management Guidelines. 1. Introduction 2. Glossary of Terms and Acronyms 3. Cryptographic Algorithms, Keys and Other Keying Material 4. Key Management.
1 Homework Study Java Cryptography by Reading the rest of slides and accessing Sun ’ s Java website:
Java supports encryption by a wide variety of packages: The standard java.security package The standard javax.crypto package Packages supplied by third.
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 ( 李德成 )
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Java Security Pingping Ma Nov 2 nd, Overview Platform Security Cryptography Authentication and Access Control Public Key Infrastructure (PKI)
Cryptography Encryption/Decryption Franci Tajnik CISA Franci Tajnik.
Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret.
Computer Network Lab. Encryption 컴퓨터 네트워크 실험실 조한진 / 이희규.
Encryption. What is Encryption? Encryption is the process of converting plain text into cipher text, with the goal of making the text unreadable.
COMPS311F Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
1 Session 3 Module 4: Java Security Module 5: Cryptography.
Csci5931 Web Security1 GS: Chapter 3 Encryption, Authentication and Java Cryptography.
A Java implemented key collision attack on the Data Encryption Standard (DES) John Loughran, Tom Dowling NUI, Maynooth, Co. Kildare, Ireland PPPJ ‘03.
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 ( 李德成 )
JCA, Cryptography for Java Programmer Shawn Shuang Zhang CS 627.
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.
@Yuan Xue 285: Network Security CS 285 Network Security Digital Signature Yuan Xue Fall 2012.
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.
@Yuan Xue 285: Network Security CS 285 Network Security Hash Algorithm Yuan Xue Fall 2012.
Lecture 8 (Chapter 18) Electronic Mail Security Prepared by Dr. Lamiaa M. Elshenawy 1.
Practical Aspects of Modern Cryptography Josh Benaloh & Brian LaMacchia.
Information and Computer Security CPIS 312 Lab 9
Lab#7 Digital signature Cpit 425
CS457 Introduction to Information Security Systems
Security Outline Encryption Algorithms Authentication Protocols
Advanced Computer Networks
Digital Signatures Assignment
Cryptography Why Cryptography Symmetric Encryption
K E Y Plain text Cipher text Encryption Decryption
Public Key Encryption and Digital Signatures
Chapter 8 Network Security.
One-way Encryption Ideal Properties
Introduction to security goals and usage of cryptographic algorithms
NETWORK PROGRAMMING CNET 441
Originally by Yu Yang and Lilly Wang Modified by T. A. Yang
One-way Encryption Properties
ICS 454 Principles of Cryptography
Java Assignment Related
GS: Chapter 4 Symmetric Encryption in Java
Asymmetric Cryptography
ELECTRONIC MAIL SECURITY
SSL (Secure Socket Layer)
ELECTRONIC MAIL SECURITY
The Secure Sockets Layer (SSL) Protocol
ICS 454 Principles of Cryptography
Chapter -7 CRYPTOGRAPHIC HASH FUNCTIONS
Hashing Hash are the auxiliary values that are used in cryptography.
Digital Signature Standard (DSS)
Presentation transcript:

Java Assignment Related

Message digest MessageDigest class getInstance(“SHA”) to feed in update(byte []) update(byte) digest(); digest(byte []) Returned as byte array

Digesting stream Example Producing byte array DigestInputStream in = new DigestInputStream( new FileInputStream(args[0]), md); Producing byte array DataOutputStream to ByteOutputStream ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(byteOut); You can do dataOut.writeLong(l) byteOut.toByteArray()

Key, KeyGenerator Key: top-level interface for all keys. defines the functionality of all key objects. KeyGenerator: This class provides the functionality of a (symmetric) key generator. static KeyGenerator getInstance(String algorithm) Generates a KeyGenerator object for the specified algorithm. void init(SecureRandom random) Initializes this key generator. SecretKey generateKey() Generates a secret key. KeyGenerator kg = KeyGenerator.getInstance("DES"); kg.init(new SecureRandom()); SecretKey key = kg.generateKey();

KeyPairGenerator Examples: KeyPairGenerator kpg = KeyPairGenerator.getInstance("ElGamal") KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA"); kpg.initialize(1024); KeyPair pair = kpg.genKeyPair(); public PublicKey getPublic() - This method returns the public key. public PrivateKey getPrivate() - This method returns the private key.

Cipher, For encryptio/decryption Assymtric and symmentric key systems static Cipher getInstance(String transformation) Generates a Cipher object that implements the specified transformation. You can use “DES/ECB/PKCS5Padding” void init(int opmode, Key key) Initializes this cipher with a key. public static final int ENCRYPT_MODE public static final int DECRYPT_MODE public final byte[] update (byte []) public final byte[] doFinal()

CipherOutputstream CipherInputstream CipherOutputStream(OutputStream os, Cipher c) Constructs a CipherOutputStream from an OutputStream and a Cipher. void write(byte[] b) Writes b.length bytes from the specified byte array to this output stream. CipherInputStream(InputStream is, Cipher c) Constructs a CipherInputStream from an InputStream and a Cipher. int read(byte[] b) Reads up to b.length bytes of data from this input stream into an array of bytes. void close() Closes this output/input stream and releases any system resources associated with this stream.

Big Integer BeigInteger(1, messagebytes) x/y mod z BigInteger.valueOf(1) x/y mod z x.multiply(y.modPow(kOne.negate(), z)).mod(z) k relatively prime to z k.gcd(z).equals(kOne) == true

Java Security API packages Java.security.cert Java.security.interfaces Java.security.spec Javax.crypto Javax.crypto.interfaces Javax.crypto.spec Some Abbreviations JCA – java cryptographic architecture JCE – java cryptographic extensions Access Control

Class or Interface Description java.security.cert.Certificate A cryptographic certificate javax.crypto.Cipher A cipher java.security.Key , java.security.PrivateKey , java.security.PublicKey , javax.crypto.SecretKey A key, used for signing or encryption javax.crypto.KeyAgreement A secret key exchange protocol java.security.KeyFactory Translates public and private keys from one format to another javax.crypto.KeyGenerator Creates keys for symmetric ciphers java.security.KeyPairGenerator Creates pairs of public and private keys for signing or encryption javax.crypto.Mac A Message Authentication Code (MAC) java.security.MessageDigest A cryptographic hash function javax.crypto.SecretKeyFactory Translates secret keys from one format to another java.security.SecureRandom A cryptographically strong random number engine java.security.Signature A digital signature

Factory Methods JCA extensively use factory methods MessageDigest md5; md5 = MessageDigest.getInstance("MD5"); Overloaded version accepts Algorithm & Provider KeyPairGenerator kpg = KeyPairGenerator("ElGamal", "Jonathan"); Cipher, keyGenerator, KeyPairGenerator, MessageDigest, Signature