54
Spring 2002 © 2000-2002, Richard A. Stanley WPI EE579T/5 #1 EE579T / CS525T Network Security 5: Authentication, PGP Prof. Richard A. Stanley

EE579T/5 #1 Spring 2002 © 2000-2002, Richard A. Stanley WPI EE579T / CS525T Network Security 5: Authentication, PGP Prof. Richard A. Stanley

  • View
    215

  • Download
    1

Embed Size (px)

Citation preview

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #1

EE579T / CS525TNetwork Security

5: Authentication, PGP

Prof. Richard A. Stanley

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #2

Overview of Tonight’s Class

• Review of last week’s class

• Class projects

• Security in the news

• Authentication

• Pretty Good Privacy

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #3

Last class ...• RSA is an asymmetric key algorithm useful for

transmitting secrets, i.e. for encryption rather than key exchange (as Diffie-Hellman)

• RSA not the only such algorithm, but it is the most widely used, especially as patents now expired

• Hash functions provide a way to do a one-way integrity computation on a variable length input

• Combining D-H, RSA, and hashing, we have all the tools needed to provide confidentiality, integrity, and authenticity

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #4

Projects

• Team 1:– Members:

• Team 2:– Members:

• Team 3:– Members:

• Team 4:– Members:

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #5

Projects

• Team 5:– Members:

• Team 6:– Members:

• Team 7:– Members:

• Team 8:– Members:

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #6

Projects

• Team 9:– Members:

• Team 10:– Members:

• Team 11:– Members:

• Team 12:– Members:

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #7

Heuristic Virus Detection?

• “Latest development” in virus detection

• Looks for characteristics in code

• Existing engines have high false positive rates

• Goal is to reduce false positives

• Also useful for intrusion detection

• No silver bullet

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #8

OE Gets Smarter?

• Outlook Express version 6– Provides some selectivity on attachments– One option provides for discarding attachments

with designated file types• Careful! Selecting the wrong types can lead to

legitimate attachments being trashed, too!

– This may be more trouble than it’s worth

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #9

RSA Example from Last Class

• Select two primes: p = 7, q = 17

• Calculate n = pq = 7 x 17 = 119

• Calculate (n) = (p-1)(q-1) = 6 x 16 = 96

• Select e relatively prime to & less than (n) – In this example e = 5

• Calculate d = e-1 mod (n) = 77

• KU = {5, 119} KR = {77, 119}Public key Private key

This bit is perhaps unclear

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #10

Another View

• d = e-1 mod (n) looks difficult, as e-1 < 1

• Multiply both sides by e, which gives– de = 1 mod (n), where (n) = 96 in this case

• e has been selected as being 5, therefore we must now find the value for d that satisfies the above equation

• 77 is that value, as 5 x 77 = 1 mod 96– 77 x 5 = 385 = 4 x 96 + 1

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #11

Basic Cryptographic AuthenticationAlice Bob

Select random n

Encrypt n with own private key

n

E(n)Decrypt E(n) w/Bob’s

public keyD[E(n)] = n ?

If yes, Bob is authenticated

This system is known as challenge / response authentication

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #12

Challenge / Response Under the Microscope

• What does this exchange really tell Alice?– Does she know who Bob is?– Can she be sure she is really connected to Bob?– Why?– Why not?

• We need a better way to do this

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #13

RSA to the Rescue?

• Consider this possibility– Generate a message– When finished, encrypt the message with your

private key – Send the message to the intended recipient– Recipient decrypts the message using your public

key– If message decrypts, recipient assumes you sent

it, and you are therefore authenticated

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #14

Flaws In This Scheme?

• What does it prove if you can decrypt a message encrypted with someone’s private key?

• What if Alice and Bob don’t know one another before this communication?– What is the basis for trust?– How is trust established?

• We’ll come back to this later

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #15

Back to Our Message

• Suppose we take the message text and hash it, producing a message digest

• Now we encrypt the hash with our private key, and append this to the end of the message

• This is called a digital signature

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #16

At the Other End...

• Recipient gets our message, and decrypts the message digest we encrypted with our private key, using our public key

• Recipient now has the message digest in cleartext

• Recipient computes the message digest over the text of the message

• If the two hashes match, the message has not been changed and it is authentic

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #17

IF...

• We can be certain that the private key used to encrypt the message digest does, in fact, belong to the person we think it does

• This requires a trust relationship so that we can have some assurance of who owns that private key

• There are two types of trust mechanisms

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #18

Web of Trust

Alice

Bob

Existing trust relationship

CarolExisting trust relationship

Derived trust relationship:Bob trusts Alice, and Alice trusts Carol,so Bob trusts Alice to introduce Carol and then Bob trusts Carol

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #19

Web of Trust Issues

• Peer-to-peer approach• Does not deal nicely with third-level and higher

unknowns– Does Bob trust Carol to introduce Don?

– How about Earl, whom none of the above know?

• Is it usable?– Yes -- this is the model used by PGP

• Does it scale nicely?– No -- scales exponentially

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #20

Hierarchy of Trust

Trust

A

B C

D E F

Root

B, C trust AD, E, F trust BF also trusts C

So, ALL trust ABUT, D, E do not trust C

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #21

Issues

• How do we know A is trustworthy?– Because A says so!

• What are the criteria for establishing trust relationships?

• Is this useful for extending trust to entities previously unknown to you?

• Does it scale?– Yes, linearly

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #22

Hierarchy is the Basis for X.500 Directory Services

• X.500 begun as the answer to harmonizing telephone directories all over the world– At its root, X.500 is a database specification– Basic implementation is the Directory Access

Protocol, DAP, which is rather “chatty”– This led, in turn, to the Lightweight Directory

Access Protocol, LDAP

• X.509 developed as way of implementing hierarchical trust structures

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #23

Enter the Certification Authority

• A Certification Authority (CA) is a trusted third party who issues Digital Certificates that bind a user to that user’s public key– The CA digitally signs the digital certificate, so

that any changes (such as substituting another public key) will be obvious

– The CA has no knowledge of the user’s private key

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #24

Digital Signatures in General

Message

MD

Encrypt w/sender’sprivate key

Digital SignatureCreation

Decrypt w/sender’spublic key

Message

MD

ComputeMD

=? No

Yes

Bogus

Authentic

Digital SignatureVerification

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #25

Digital Certificates

• Clearly, for this to work, all parties must use the same format for the certificates

• The most popular (but not the only) standard in current use is X.509 v3

• An X.509 certificate has a fixed format, and contains certain mandatory items, in a prescribed order, so it is easy for a computer to scan and verify

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #26

X.509 Certificate Contents• Version

• Serial number

• Signature algorithm identity

• Name of issuing CA

• Period of validity (not before - not after)

• Subject name to whom certificate refers

• Subject’s public key

• Subject distinguished name (X.500)

• Extensions (added in X.509 v3)

• Digital signature over the entire certificate

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #27

Uses for Certificates

• Anyone can obtain the digital certificate for anyone else with whom they wish to conduct secure communications, whether or not they have a previous relationship

• The CA attests that the public key in the certificate is really the public key of the subject named in the certificate. You know who you are talking to! (Or do you?)

• This greatly facilitates electronic commerce

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #28

More Issues With CA’s

• How do you trust the CA?

• Who guarantees the “goodness” of the top of the hierarchy?

• What are the liability issues?

• Does this really guarantee you know who’s who in the digital world?

• Come back next class to see...

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #29

Pretty Good Privacy (PGP)• Arguably, the first quality crypto system, not

developed by or for a government, that is available to non-government entities

• Developed by Phil Zimmerman– When developed, held to violate the Munitions Act

which barred export of encryption

– U. S. Government brought charges against Mr. Zimmerman, which were ultimately dropped

• Available worldwide, free over Internet

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #30

PGP

• Versions available for most OS’s

• Algorithms have passed extensive public review, considered extremely secure

• Wide applicability

• Developed outside of any governmental agencies– In fact, drew (and continues to draw) the wrath

of many governments

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #31

Availability

• Network Associates has been offering a commercial version of PGP– Recently announced this business unit will be

discontinued by mid-2002– Future of commercial version in doubt

• Freeware version continues to be available over the Internet, together with source code

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #32

Algorithms Supported• Symmetric encryption

– CAST-128– IDEA– TDEA (3 key, 168 bits)

• Asymmetric encryption– RSA– DSS (Digital Signature Standard)– El Gamal

• Hashing– SHA-1

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #33

PGP Functions

• Digital signature• Message confidentiality• Data compression• E-mail compatibility

– Only sends ASCII characters– Cf. Kermit

• Internet / email message size compatibility– Segmentation of large messages

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #34

PGP Digital Signature

• Hash message using SHA-1

• Encrypt hash with RSA using sender’s private key

• Prepend encrypted hash to message

• Recipient decrypts hash with sender’s public key

• Generates new hash, compares with decode– Message authentic if match

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #35

PGP Digital Signatures

Message

SHA-1

Encrypt w/sender’sprivate key

Digital SignatureCreation

Decrypt w/sender’spublic key

Message

SHA-1

ComputeSHA-1

=? No

Yes

Bogus

Authentic

Digital SignatureVerification

RSA*

RSA*

* Alternatively, DSS (FIPS PUB 186)

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #36

PGP Signature Features

• Choice of two encryption algorithms– RSA– DSS (Digital Signature Standard, FIPS 186)

• Signatures can be detached from message– Facilitates separate signature log– Signature can be virus check on executable– Enables multiple signatures on single message

without nesting the signatures (e.g., contracts)

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #37

PGP Encryption Options

• Uses one of these symmetric systems– TDEA with three keys (you know this one)– CAST-128– IDEA

• Sender generates session key

• RSA used to encrypt session key, which is prepended to the encrypted message

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #38

IDEA

• International Data Encryption Algorithm– By Xuejia Lai and James Massey, Swiss

Federal Institute of Technology, 1991– Feistel cipher, well-reviewed

• Eight rounds

• No S-boxes in round function– XOR, binary addition and multiplication (16-bit integers)

• Complex subkey generation using circular shifts– Six subkeys for each round

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #39

CAST-128 Cipher• Carlisle Adams & Stafford Tavares, 1997

– IETF RFC 2144 defines– Key size: 40, 48, 56,…,128 bits– Extensive review, becoming fairly common– Feistel cipher

• Fixed S-boxes, larger than DES

• S-boxes designed to be nonlinear, resistant to cryptanalysis

• Subkeys also generated by nonlinear processes

• Round function varies from round to round

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #40

PGP Confidentiality

• Sender generates random 128-bit number as session key for this message only

• Message encrypted with session key• Session key encrypted with recipient’s public

key, and prepended to message• Recipient decrypts session key with

recipient’s private key• Uses session key to decrypt message

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #41

Options

• Can use RSA or El Gamal to encrypt session key

• Key sizes– 768 to 3072 bits– DSS signatures fixed at 1024 bits

• Confidentiality and authentication can be combined in a single message– A very good idea!

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #42

Authenticated Secure Message

• Sender signs message with own private key

• Sender generates session key and encrypts message with the session key

• Sender encrypts session key with recipient’s public key

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #43

Compression

• PGP was targeted at email, so compression is an important feature

• Compression (ZIP) applied after signature, but before encryption of message body– Ensures same signature despite compression

• Compressed message is encrypted– Less redundancy than original, so cryptanalysis

harder

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #44

Compatibility• After encryption, message contains stream of

arbitrary binary octets• Some email systems permit transmission of only

ASCII text• PGP provides option to convert data stream to

blocks of ASCII text for compatibility– 3 octets become 4 ASCII characters

– Known as Radix-64 conversion

– Expands size by 33% (because 3 become 4)

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #45

Radix-64 Conversion

• Straightforward mapping of binary 6-bit values into printable ASCII characters– no hyphen, no control characters

• Expands input by 33%, but ZIP still provides about 33% overall compression

• Even if input is ASCII, conversion will be done if selected, which provides primitive level of confidentiality absent encryption

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #46

Segmentation

• Some systems limit the size of messages, often to about 50K octets

• PGP provides a built-in service to segment messages into parts small enough to transit the system, and then to reassemble the message properly at the destination for presentation to the recipient

• Much like packet assembly / disassembly

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #47

PGP Keys

• Four types– One-time session keys– Public keys– Private keys– Passphrase-based keys

• User may desire multiple public/private key pairs– How does recipient know which one was used?

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #48

Key Identifiers

• So that recipient knows which public key was used, a key ID is transmitted with the message– Key ID = least significant 64 bits of the public

key• Avoids wasted BW if entire public key were sent

• Very low probability of duplicate key Ids

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #49

Key Rings

• Simply tables of private and public keys, where each row represents one key pair– Can be indexed by user ID or key ID

• Private key not stored in clear in key ring– Encrypted using CAST-128, etc.– Passphrase used to access private-key ring

• Passphrase is hashed with SHA-1

• First 128 bits used to encrypt private key

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #50

Key Management

• PGP uses the Web of Trust key management model– Therefore, you must trust someone else to sign a third

party’s key

– Provides for partial levels of trust• Difficult--is someone 40% trusted or 62%?

• What does this mean in practice?

– How to deal with wholly unknown third parties?

• PGP proponents dismiss these concerns, but they are serious issues for e-commerce, etc.

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #51

PGP Web of Trust

Trust

You

B C

D E F

You trust CYou partially trust B

C trusts F

So, you trust C to sign for FBUT, you partially trust B to

sign for D, E, FWhat does this mean?

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #52

Digital Certificates Summary

• Combining hashing algorithms and asymmetric cryptography, it is possible to digitally sign a message

• A digitally signed message can, under certain conditions, assure both integrity of the contents and authenticity of the sender

• Trust relationships are necessary to extend this concept. The most common such system is X.509 v3

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #53

PGP In Summary

• Very good cryptosystem, providing confidentiality, authentication, and features to make it compatible with email

• Despised by governments worldwide, and subject to legal restrictions in many places

• Complex key management scheme that does not scale well to large systems where parties previously unknown need services

Spring 2002© 2000-2002, Richard A. Stanley

WPI EE579T/5 #54

Homework

• Read Stallings, Chapter 5.1, Chapter 6, on IPSec

• Do Stallings, Problems 4.3, 4.4, 5.1, 5.2, 5.4