















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















CS 580 Client-Server Programming Fall Semester, 2002 Doc 25 Security Contents Security......................................................................................... 2 General Security Issues ............................................................. 8 One-Way Hash Functions ........................................................ 11 Encryption ................................................................................ 17 References NIH Security Web Site http://www.alw.nih.gov/Security/security.html Applied Cryptography Second Edition, Bruce Schneier, John Wiley & Sons, 1996 Red Team versus the Agents, Scientific American, December 2000, pp. 20, 24.
Security Some common issues
Security through Obscurity Security relies on encryption/authentication methods are not obvious. Some examples:
Security in the Wrong Place Always think about what you're trying to accomplish with a security system. Examples: Client performs authentication locally
Back doors Programmers have the tendency to add debug code to their servers to make testing easier. This debug code may circumvent any security features of the server. Example
General Security Issues Points to keep in mind when dealing with security:
Authentication methods: Basic Username and password Protocols we have seen that use this:
One-Way Hash Functions Let M be a message (sequence of bytes) A one-way hash function f() such that:
Using MD5 & SHA in Java import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class SampleCode { public static void main(String args[]) throws NoSuchAlgorithmException { MessageDigest sha = MessageDigest.getInstance("SHA"); sha.update("Hi mom".getBytes()); byte[] shaHash = sha.digest(); System.out.println(new String(shaHash)); MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update("Hi mom".getBytes()); byte[] md5Hash = md5.digest(); System.out.println(new String(md5Hash)); } }
Using MD5 & SHA in Smalltalk Load the MD5 & SHA parcels 'Hi mom' asByteArray md5Value 151963197781583193299119603806589129963 'Hi mom' asByteArray shaValue 559954799469170145248016473141621118947215272720
Practical security token issues How can a server identify a client with a token? Rely on a piece of information that is hard to change: IP address of the client The server must correlate the token with the address when the client uses it. How can this be done? A random string which identifies the client A one-way scrambled string with client information
Encryption After a client has been authenticated, the traffic on a network can still be sniffed. A solution is encryption of all traffic. This can be done at any layer of the protocol stack Two basic types of encryption:
Public Key Key contains n & e where n = pq, p & q are primes e relatively prime to (p-1)(q-1) p & q must be kept secret Private Key d is e
Example Example is from page 467-8 of Schneier Alice’s Keys Let p = 47. q = 71. Then n = p*q = 3337 e = 79. Then d = 79