Presentation is loading. Please wait.

Presentation is loading. Please wait.

Csci5931 Web Security1 GS: Chapter 3 Encryption, Authentication and Java Cryptography.

Similar presentations


Presentation on theme: "Csci5931 Web Security1 GS: Chapter 3 Encryption, Authentication and Java Cryptography."— Presentation transcript:

1 csci5931 Web Security1 GS: Chapter 3 Encryption, Authentication and Java Cryptography

2 csci5931 Web Security2 Cryptography & Java A. Encryption B. Authentication C. Java Cryptography

3 csci5931 Web Security3 Encryption  Encryption Basics:  An algorithm (or cipher) and a key are required in order to encrypt or decrypt messages.  Example: the Caesar cipher (p.34) o A symmetric, stream cipher o Exercise: Encrypt “DDAY” using Caesar cipher (5). o Answer: “IIFD”. o Q: What is the algorithm? o Q: What is the key? o Q: How would the cipher be decrypted?

4 csci5931 Web Security4 Encryption  Symmetric Encryptions:  Both the encrypter and the decrypter share the same key.  Key space: The set of possible keys that work with a cipher; determined by the number of bits used in the cipher.  The larger the key space is, the more secure the encryption will be.  Each additional bit added to the key length doubles its security.

5 csci5931 Web Security5 Encryption  Symmetric Encryptions:  Two types of symmetric ciphers: block ciphers and stream ciphers.  Examples of symmetric encryptions: o DES (Data Encryption Standard) & TripleDES: block ciphers o Blowfish: a faster and more secure replacement of DES o RC4 (Rivest’s Code 4): a stream cipher o AES (Advanced Encryption Standard): a block cipher

6 csci5931 Web Security6 Encryption  Limitations of Symmetric Encryptions:  Key distribution can be a vulnerability.  If the key is exposed, the encrypted message and all future communication using the same key will suffer the eavesdropping attack.  Key management problems: distribution, update, revoking

7 csci5931 Web Security7 Encryption  Asymmetric Encryptions:  Also known as ‘public key encryption’  Messages encrypted with the public key can only be decrypted by the corresponding private key.  The public key can be made known to the public, but the private key is kept as secret and only known to the owner of the key.  Examples of asymmetric encryption algorithms: o Merkel Hellman Knapsacks o RSA: Rivest, Shamir, Adleman o El Gamal

8 csci5931 Web Security8 Encryption  Limitations of asymmetric Encryptions:  Asymmetric encryption requires much larger keys than symmetric encryption. o A 1024-bit asymmetric key ~= a 128-bit symmetric key o Why?  Asymmetric encryption is much slower (~ 1000 times slower) than symmetric encryption.  It is subject to man-in-the-middle attack. Solution? Digital certificates (Ch. 6)

9 csci5931 Web Security9 Encryption  Session-key Encryption  A session-key is a symmetric key that is used to encrypt the plaintext message. The session key itself is encrypted using a public key.  Sender: C = Spub ( S ) + Sencrypt (message)  Recipient  Recipient: Spriv ( Spub (S) )  S Sdecrypt (Sencrypt (message))  message  Alternatively, the session key may be assigned an expiration time and be used over several sessions.

10 csci5931 Web Security10 Encryption  Examples of Session-key Encryption  PGP (Pretty Good Privacy): Originally (1991) used to encrypt e-mail using session-key encryption Supports RSA, TripleDES, etc. http://www.pgp.com/  S/MIME (Secure/MIME): Invented by RSA to secure e-mail Backed by Microsoft, RSA, and AOL  SSL/TLS (Secure Socket Layer/Transport Layer Security): Ch. 9 Originally an attempt to secure TCP/IP traffic using encryptions

11 csci5931 Web Security11 Encryption  Key Agreement Algorithm  A key agreement algorithm takes the private and the public keys of two distinct parties (Apriv + Bpub or Apub + Bpriv) and generates a common shared secret key, which is then used to generate a session key. See the diagram on p.41.  Diffie-Hellman Key Agreement Algorithm: The first ever public key encryption  Allows two parties to independently generate the shared key; The session key is never transmitted.  References: See http://www.apocalypse.org/pub/u/seven/diffie.html http://www.apocalypse.org/pub/u/seven/diffie.html IETF RFC2631: http://www.ietf.org/rfc/rfc2631.txt http://www.ietf.org/rfc/rfc2631.txt

12 csci5931 Web Security12 Encryption  Strength of Encryption Algorithms  Two factors: The algorithm used + The size of the key space  See the tables comparing symmetric ciphers (p.42) and asymmetric ciphers (p.43)

13 csci5931 Web Security13 Alternative Data-hiding Methods  Steganography: hiding messages inside another message or in a picture. See “Steganography: Hidden Data”. By Deborah Radcliff. ComputerWorld. June 10, 2002.Steganography: Hidden Data  Elliptic Curve Cryptography (ECC): based on the elliptic curve logarithm problem; a more efficient public key encryption (faster, smaller key size) An intro: http://world.std.com/~dpj/elliptic.htmlhttp://world.std.com/~dpj/elliptic.html  Codes, one-time pads, etc.

14 csci5931 Web Security14 Authentication  The process of determining the authenticity of a message or user.  Methods: A. Message Digest  a check value generated from a document, usually generated by a hash function  to prove that the data in the document has not been tampered with.  Commonly used for password authentication (i.e., one-way authentication)  Examples: MD4, MD5, SHA (secure hash algorithm)  Any problem? Man-in-the-middle attack Why?

15 csci5931 Web Security15 Authentication Methods B. MAC (Message Authentication Codes)  A message digest created with a key  Typically used for data verification in a context where a secure connection is already available.  Example: SSL uses MACs to verify the data received, using a secret key that is exchanged at the beginning of the session.  Example MACs: o HmacMD5 (Hashing MAC using MD5) o HmacSHA1 (Hashing MAC using SHA-1)

16 csci5931 Web Security16 Authentication Methods C. Digital Signatures  Based on public key encryption  Computed with a person’s private key and verified with the person’s public key  An example of creating a digital signature: p.48 1. The sender applies a message digest algorithm to get a message digest (md) out of the message to be sent. 2. The message digest is then encrypted by the person’s private key. The ciphertext is the digital signature (ds).  To check the digital signature: 1. The recipient applies the digest algorithm to get a message digest (md-2). 2. The recipient decrypts the ds using the sender’s public key. 3. The output from step 2 is verified against md-2.

17 csci5931 Web Security17 Authentication Methods D. Digital Certificates  Purpose: To authenticate a person’s public key  “Vouching”: one party certifies that another party’s identity is authentic. e.g., passport, id cards  A digital certificate for A is A’s public key plus some identifying information, signed by the private key of a certification authority (CA) verifying A’s identity.  Other example usage of certificates: o To authenticate a host/server (e.g., SSL certificates) o To sign and encrypt e-mail

18 csci5931 Web Security18 Authentication Methods D. Digital Certificates (Cont.)  Certificates are often chained. That is, a CA may be authenticated by a root CA.  The top CA of a certificate chain must be self-signed.  Verisign has been accepted as the top CA.  Example of certificate chaining: Both Internet Explorer and Netscape Communicator include certificates from Verisign in their install. So when the browser makes an SSL connection to a server, if the server presents a certificate that is signed by Verisign, the server’s certificate will be automatically accepted.

19 csci5931 Web Security19 Cryptanalysis  The practice of analyzing and breaking cryptography  Mehtods:  Brute force attack versus the key space  Common cryptanalytic tools: Frequency distribution, Digram/trigram study, IC, Repeated patterns, Probable letters  4 cryptanalytic cases: 1.Ciphertext only  Ciphertext-only attack 2.Full or partial plaintext  Known plaintext attack  Probable plaintext analysis 3.Ciphertext of any plaintext  Chosen plaintext attack 4.Algorithm + Ciphertext  Chosen ciphertext attack

20 csci5931 Web Security20 Key Management (storage)  A dilemma: Keys must be securely stored while allowing users easy access when necessary.  A typical solution is to encrypt the stored keys with passwords and then protect the storage with the OS access control.  A key storage is an attractive target for attack.  The smart card solution: A smart card stores a private key and a certificate, which can be used to encrypt and/or decrypt information.  An example of smart card solution: See Protection of Keys (RSA vs nCipher)Protection of Keys (RSA vs nCipher)

21 csci5931 Web Security21 Cryptographical Protocols  Cryptographical protocols determine the exact order and way in which each algorithm must be used in order to maximize security.  Examples of protocols: –Distribution of keys, –Certificates, Digital signatures, –Key escrow, –Mental poker, –Electronic voting, –oblivious transfer, contract signing, –certified mail

22 csci5931 Web Security22 JCA/JCE  Java Cryptography Architecture (JCA) is part of the Java 2 run-time environment.  java.security.*  JCE (Java Cryptography Extension), on the other hand, is an extension to the JCA. JCE adds encryption and decryption APIs to the JCA.  java.crypto.*  Major classes defined in JCA: MessageDigest, Signature, KeyPairGenerator, KeyFactory, CertificateFactory, KeyStore, AlgorithmParameters, AlgorithmParameterGenerator, SecureRandom, …

23 csci5931 Web Security23 JCA/JCE  A cryptographic service provider implements various cryptographic algorithms.  See page 54 for a list of algorithms implemented in the SUN provider (sun.security.provider.Sun), Java 2 (v1.2).  A second provider, the RSAJCA provider (com.sun.rsajca.Provider) is shipped with JDK v1.3, to provide RSA-specific cryptos.

24 csci5931 Web Security24 JCA  An example of using MessageDigest in the JCA: 1. Get an instance of a message digest. MessageDigest myMessageDigest = MessageDigest.getInstance (“MD5”); Or MessageDigest myMessageDigest = MessageDigest.getInstance (“MD5”,”Sun”); 2. Add data to be digested. myMessageDigest.update (myData); 3. Get the digest. byte [ ] signatureBytes = myMessageDigest.digest ( );

25 csci5931 Web Security25 JCE  Major JCE classes: Cipher, KeyAgreement, KeyGenerator, MAC, SecretKey, SecretKeyFactory  JCE needs to be separately downloaded and installed if you have JDK older than v1.4. For JDK1.4 or higher, JCE is an integrated component.  See http://java.sun.com/products/jce/index-14.html for more details.http://java.sun.com/products/jce/index-14.html

26 csci5931 Web Security26 JCE  Installation of JCE security provider Installation of JCE security provider  Sample programs: http://nas.cl.uh.edu/yang/teaching/csci5931webSecurity/JC E%20provider.htm http://nas.cl.uh.edu/yang/teaching/csci5931webSecurity/JC E%20provider.htm  Visit http://sce.cl.uh.edu/yang/teaching/proJavaSecurityCode.htm l and download all the sample programs from the book. http://sce.cl.uh.edu/yang/teaching/proJavaSecurityCode.htm l

27 csci5931 Web Security27 Next  Symmetric Encryption (GS: 4)  Asymmetric Encryption (GS: 5)


Download ppt "Csci5931 Web Security1 GS: Chapter 3 Encryption, Authentication and Java Cryptography."

Similar presentations


Ads by Google