Playing Safe Vancouver PHP Conference January 22nd, 2004. Vancouver, Canada Derick Rethans <
[email protected]> Slide 1/29 Questions May 16 2004 ? - 2 - Slide 2/29 Why use encryption? May 16 2004 o - 3 - Slide 3/29 Quote May 16 2004 "People who are willing to rely on the government to keep them safe are pretty much standing on Darwin's mat, pounding on the door, screaming, 'Take me, take me!'" Carl Jacobs, Alt.Sysadmin.Recovery - 4 - Slide 4/29 Cipher groups May 16 2004 o Rotational (ceasar) o Transposition (xor) o Symmetric (DES, Blowfish, AES) o Asymmetric (RSA, Diffie Hellman) o Hashes - 5 - Slide 5/29 Rotational ciphers May 16 2004 o Rotate characters depending on key o Easy to crack unless key is same size as plain text o But we always have str_rot13() :-) - 6 - Slide 6/29 Transposition ciphers May 16 2004 o XOR plain text with key o Easy to crack with small key o Impossible to crack when<br /> strlen(plain) == strlen(key) - 7 - Slide 7/29 Quote May 16 2004 "Perl - The only language that looks the same before and after RSA encryption." Keith Bostic - 8 - Slide 8/29 Asymmetric ciphers May 16 2004 o Key to encrypt is different as the key to decrypt o ElGamal, Diffie Hellman, RSA o Used for signatures and key distribution - 9 - Slide 9/29 Hash algorithms May 16 2004 o Not reversable o PHP: sha1(), md5(); mhash: GOST, HAVAL o Used for in signatures and validation - 10 - Slide 10/29 Hash Example May 16 2004 <?php if (isset($_COOKIE['stamp'])) { if ($_COOKIE['stamp'] == sha1($_COOKIE['data'] .