Crypto for SysAdmins

An impossibly brief overview of the last 35 years of cryptographic science crammed into 90 minutes...

Really, just a overview of the tools and techniques in modern cryptography.

Or, a brief introduction to “Most of what you need to know” in modern system administration.

Bob Krzaczek
Laboratory for Imaging Algorithms and Systems
Chester F. Carlson Center for Imaging Science
Rochester Institute of Technology
phone +1-585-4757196, email krz@cis.rit.edu, icbm N43.0848 W77.6789





Why?


What We're Going To Cover

Hashes

example of CRC output

Checksums, Cyclic Redundancy Codes

sum, CRC-16, CRC-32, CRC-64


Hashes

example of hash algorithms

Cryptographic Hashes

Snefru, MD5, SHA-1, RIPEMD, HAVAL

Avoids collisions
  • Large output space
  • More even distribution of outputs
Better entropy
  • Single bit differences in input yield more changes in output
  • Changes are more “scattered” through the output
Unpredictable output
  • Prevents tailoring of data to a particular output
  • Prevents guessing bits of input from the output

Hashes

Cryptographic Hashes

Snefru, MD5, SHA-1, RIPE-MD, HAVAL

Resulting in
  • Strong certainty that a hash uniquely represents its input
  • Work with a given input without actually revealing its contents.
  • Detect unexpected or unauthorized tampering with data;
    or, detect changes to data or any size without storing copies for comparison
  • Provide effective, verifiable, and nearly unique fingerprints for data

Ciphers

encryption/decryption illus
Plaintext
Data in its original form.
Cipher (aka Cypher, Encryption)
An algorithm for obfuscating data in a way that can be later undone, yielding the original data.
Ciphertext
Data in an obscured, or encrypted, form.
Key
Relatively small bit of data that drives a cipher's execution in a unique and unpredictable way.
Common Expressions
EK( M ) = C
DK( C ) = M
DK( EK( M )) = M

Ciphers

rot-2 encryption

ROT

A Simple Substitution Cipher

Analysis


Ciphers

Symmetric and Asymmetric

Ciphers are generally categorized as:

Symmetric
  • The same key that encrypts the data also drives the decryption process.
  • ROT, DES, IDEA, RC5, Blowfish, Twofish, AES
  • EK( M ) = C      DK( C ) = M
Asymmetric, or Public Key
  • Uses different keys for encryption and decryption.
  • RSA, El Gamal
  • EKpri( M ) = C      DKpub( C ) = M     Kpub ≠ Kpri

Ciphers

symmetric cipher

Symmetric

DES, IDEA, RC5, Blowfish, Twofish, AES


Ciphers

Symmetric

DES
The old Data Encryption Standard from 1976, based on IBM's Lucifer algorithm (1972). Uses a 56 bit key, and is no longer considered strong given modern computing power.
Triple DES
Three passes through DES with two different 56 bit keys, effecting a 112 bit key. Used when compatibility with older DES systems is required: set both keys equal.
C = EK1( DK2( EK1( M )))
M = DK1( EK2( DK1( C )))
AES
Advanced Encryption Standard, supports [128,256] bit keys. Chosen in 2001, made into a standard by NIST in 2002.

Ciphers

Symmetric

IDEA
International Data Encryption Algorithm, widely used in older PGP implementations. Patented, but freely available for non-commercial use. At one time, was considered one of the best alternatives to DES.
RC2, RC4, RC5
Rivest's Cipher (by Ron Rivest of RSA). RC5 was gaining popularity until NIST chose AES. Still see this family widely used in S/MIME and SSL.
Blowfish, Twofish
Bruce Schneier's algorithms. Twofish was a strong candidate for AES (along with RC5 and everyone else). Wide use in SSH. Very popular among crypto hackers.

Keys

Why does key length matter?

Time to perform a brute force search for comparable symmetric key algorithms...

Key Length (bits) 1995 2000 2005
40 68 seconds 8.6 seconds 1.1 seconds
56 7.4 weeks 6.5 days 19 hours
64 36.2 years 4.6 years 6.9 months
128 6.7 1020 years 8.4 1019 years 1.1 1019 years

Ciphers

asymmetric cipher

Public Key

RSA, El Gamal


Ciphers

Private Key Cipher: RSA

Public Key
N = product of two primes, P and Q
E = relatively prime to (P-1)(Q-1)
Private Key
D = E-1 mod (P-1)(Q-1)
Encryption
C = ME mod N
Decryption
M = CD mod N
To Break
You have to factor the product of two prime numbers, each of which may be hundreds of digits in length.

Ciphers

Private Key Cipher: El Gamal

Public Key
P = prime
G < P
Y = GX
Private Key
X < P
Encryption
K = relatively prime to P-1
A = GK mod P
B = YKM mod P
Decryption
M = B / AX mod P
To Break
You have to compute logarithms in a discrete (modulo) field.

Keys

bank transaction

Symmetric Cryptography


Keys

man in the middle attack

Man In The Middle Attack

This is also an example of a Protocol Attack. Note that the cipher algorithm itself is not under attack; instead, its useis being attacked.

Most failures in cryptography are not the fault of the algorithms; they are the result of bad protocols!


Keys

Public Key Cryptography

Protocols and Applications

We've got the basics down.

Combining these tools is where the real fun starts...

Probably a good time to take a break...

Protocols

Key Exchange

Problem
You want to communicate with someone at a distance using a fast symmetric cipher. How can you send them the key without eavesdroppers getting it, too?
Approach: Symmetric Key Exchange
In-room demonstration...

Protocols

Key Exchange

Problem
You want to send someone your public key. How do you know they get your key and not someone else?
Approach: Hash the Public Keys
  1. Both sides of the conversation have private keys and exchange public keys.
  2. Send each other a public key.
  3. Generate a hash of your public key. Ask them to do the same.
  4. Confirm (in person, over the phone) that the public keys match.
Alternatives: Publish your Public Keys
  • Newspaper Classified Ads
  • Public Key Servers

Protocols

Key Exchange

Problem
You want to communicate with someone at a distance using a fast symmetric cipher. How can you send them the key without eavesdroppers getting it, too?
Approach: Private Key Cryptography
  1. Generate a new random symmetric key.
  2. Encrypt it with your private key.
  3. Encrypt that using their public key.
  4. Send them the doubly-encrypted symmetric key.
  5. First, they decrypt using their private key.
  6. Next, they descrypt using your public key.
  7. Result: they have the session key.

Protocols

Digital Signature

Problem
How to sign publicly available (unencrypted) data? More importantly, once signed, how do you prove the data hasn't changed later, in the future?
Approach: Public Key Encryption with a Secure Hash
You:
  1. Generate a secure hash of the data. Throw in the current date and other info if you want.
  2. Encrypt that hash with your private key.
  3. Publish the encrypted document.
They:
  1. Obtain the data to be verified, along with your encrypted data.
  2. Generate a secure hash of the data.
  3. Decrypt your encrypted data.
  4. Compare the hashes to see if they match (along with whatever other data was encrypted).

Protocols

Digital Signature

The combination of secure hashes with private key encryption improves the latter:

Oh, so that's why...