Cryptography and Network Security Sicurezza delle reti e...

72
Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici SSL/TSL

Transcript of Cryptography and Network Security Sicurezza delle reti e...

Page 1: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Cryptography and Network Security

Sicurezza delle reti e dei sistemi informatici

SSL/TSL

Page 2: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Security architecture and protocol stack

IP

TCP

SSL/TLS

Applicat. (SHTTP)

IPSEC

Secure applications: PGP, SHTTP, SFTP,…

or

Security down in the protocol stack

-SSL between TCP and applic. layer

- IPSEC between TCP and IP

2April 2010 CNS & SiReSI

Page 3: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS intro

• Transport Layer Security (TLS) and its predecessor, Secure Sockets Layer (SSL), are cryptographic protocols that provide security for communications over networks

• TLS and SSL encrypt the segments of network connections at the Transport Layer end-to-end

3April 2010 CNS & SiReSI

Page 4: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS intro, continued

• Several versions of the protocols are in widespread use in applications like web browsing, electronic mail, Internet faxing, instant messaging and VoIP

• TLS is an IETF standards track protocol, last updated in RFC 5246, that was based on the earlier SSL specifications developed by Netscape Corporation

4April 2010 CNS & SiReSI

Page 5: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS intro, continued 2

• SSL/TLS allow client/server applications to communicate across a network in a way designed to prevent eavesdropping, tampering and message forgery

• provide endpoint authentication and communications confidentiality over the Internet using cryptography. – RSA security with 1024 and 2048 bit

strengths

5April 2010 CNS & SiReSI

Page 6: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

main threats addressed

• eavesdropping = the act of secretly listening to private conversation

• tampering = the act of altering something secretly or improperly

• message forgery = sending of a message to deceive the recipient as to whom the real sender is

6April 2010 CNS & SiReSI

Page 7: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS intro, continued 3

• In typical end-user/browser usage, TLS authentication is unilateral: only server is authenticated, but not vice

• TLS also supports mutual authentication– provided that partners diligently scrutinize

identity information

7April 2010 CNS & SiReSI

Page 8: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS intro, continued 4

• Mutual authentication requires that the TLS client-side also holds a certificate (which is not usually the case in the end-user/browser scenario)– Unless TLS-PSK, the Secure Remote

Password (SRP) protocol, or some other protocol is used that can provide strong mutual authentication in the absence of certificates

8April 2010 CNS & SiReSI

Page 9: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS intro, continued 5

TLS involves three basic phases:

1. Peer negotiation for algorithm support

2. Key exchange and authentication

3. Symmetric cipher encryption and message authentication

9April 2010 CNS & SiReSI

Page 10: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS intro, continued 6

• During first phase, client and server negotiate cipher suites, which determine ciphers to be used, key exchange and authentication algorithms, as well as message authentication codes (MACs)– key exchange and authentication algorithms

are typically public key algorithms, or, as in TLS-PSK, preshared keys (PSKs) could be used

– message authentication codes are made up from cryptographic hash functions using the HMAC construction for TLS, and a non-standard pseudorandom function for SSL.

10April 2010 CNS & SiReSI

Page 11: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL/TLS: typical algorithms

• For key exchange: RSA, Diffie-Hellman, ECDH (Elliptic Curve Diffie–Hellman), SRP (Secure Remote Password protocol), PSK

• For authentication: RSA, DSA, ECDSA (Elliptic Curve Digital Signature Algorithm)

• Symmetric ciphers: RC4, Triple DES, AES, IDEA, DES, or Camellia. In older versions of SSL, RC2 was also used.

• For cryptographic hash function: HMAC-MD5 or HMAC-SHA are used for TLS, MD5 and SHA for SSL, while older versions of SSL also used MD2 and MD4.

April 2010 CNS & SiReSI 11

Page 12: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SLL/TLS and digital certificates

• The key information and certificates necessary for TLS are handled in the form of X.509 certificates, which define required fields and data formats.

12April 2010 CNS & SiReSI

Page 13: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

how SSL/TLS works 1/5

• Client and server negotiate a stateful connection by using a handshaking procedure. During handshake, client and server agree on various parameters used to establish connection's security

• Handshake begins when client connects to TLS-enabled server requesting a secure connection and presents a list of supported ciphers and hash functions

• From this list, server picks the strongest cipher and hash function that it also supports and notifies client of the decision

April 2010 CNS & SiReSI 13

Page 14: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

how SSL/TLS works 2/5

• Server sends back its identification in the form of a digital certificate X.509

• Client may contact the CA and confirm that the certificate is authentic and not revoked before proceeding– modern browsers support Extended

Validation certificates

April 2010 CNS & SiReSI 14

Page 15: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

how SSL/TLS works 3/5

• For generating session keys used for secure connection, client encrypts a random number (RN) with server's public key (PbK), and sends result to server. – Only server is able to decrypt it (with its

private key (PvK)): this is the one fact that makes the keys hidden from third parties, since only the server and the client have access to this data.

15April 2010 CNS & SiReSI

Page 16: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

how SSL/TLS works 4/5

• Client knows PbK and RN, and server knows PvK and (after decryption of the client's message) RN. A third party may only know PbK, unless PvK has been compromised.

• From the random number, both parties generate key material for encryption and decryption.

16April 2010 CNS & SiReSI

Page 17: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

how SSL/TLS works 5/5

• This concludes the handshake and begins the secured connection, which is encrypted and decrypted with the key material until the connection closes.

• If any one of the above steps fails, the TLS handshake fails, and the connection is not created.

17April 2010 CNS & SiReSI

Page 18: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL (Secure Socket Layer)

• transport layer security service• uses TCP to provide a reliable end-to-end

service– originally developed by Netscape– version 3 designed with public input– subsequently became Internet standard known as

TLS (Transport Layer Security)

• SSL has two layers of protocols

18April 2010 CNS & SiReSI

Page 19: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL Architecture

19April 2010 CNS & SiReSI

Page 20: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL Architecture

• SSL session– an association between client & server– created by the Handshake Protocol– defines a set of cryptographic parameters– maybe shared by multiple SSL connections (re-

negotiating can be onerous)– stateful

• SSL connection– a transient, peer-to-peer, communications link– associated with 1 SSL session– stateful

April 2010 CNS & SiReSI 20

Page 21: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

parameters defining session state

• Session identifierarbitrary byte sequence chosen by the server to identify an active or resumable session state

• Peer certificateX509.v3 certificate of the peer. This element of the state may be null

• Compression methodThe algorithm used to compress data prior to encryption.

21April 2010 CNS & SiReSI

Page 22: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

parameters defining session state

• Cipher specSpecifies the bulk data encryption algorithm (such as null, DES, etc.) and hash algorithm (such as MD5 or SHA-l) used for MAC calculation. It also defines cryptographic attributes such as the hash_size.

• Master secret 48-byte secret shared between the client and server.

• Is resumableflag indicating whether the session can be used to initiate new connections.

22April 2010 CNS & SiReSI

Page 23: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

parameters defining connection state

• Server and client randomByte sequences that are chosen by the server and client for each connection.

• Server write MAC secretThe secret key used in MAC operations on data sent by the server

• Client write MAC secretThe secret key used in MAC operations on data sent by the client.

• Server write keyThe conventional encryption key for data encrypted by the server and decrypted by the client

23April 2010 CNS & SiReSI

Page 24: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

parameters defining connection state

• Client write keyThe conventional encryption key for data encrypted by the client and decrypted by the server.

• Initialization vectorsWhen a block cipher in CBC mode is used, an initialization vector (IV) is maintained for each key. This field is first initialized by the SSL Handshake Protocol. Thereafter the final ciphertext block from each record is preserved for use as the IV with the following record

24April 2010 CNS & SiReSI

Page 25: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

parameters defining connection state

• Sequence numbersEach party maintains separate sequence numbers for transmitted and received messages for each connection. When a party sends or receives a change cipher spec message, the appropriate sequence number is set to zero. Sequence numbers may not exceed 264- 1.

25April 2010 CNS & SiReSI

Page 26: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL Record Protocol

two main services• confidentiality

– using symmetric encryption with a shared secret key defined by Handshake Protocol

– IDEA, RC2-40, DES-40, DES, 3DES, Fortezza, RC4-40, RC4-128

– message is compressed before encryption

• message integrity– using a MAC with shared secret key– similar to HMAC but with different padding

April 2010 CNS & SiReSI 26

Page 27: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL - Record Protocol

27April 2010 CNS & SiReSI

Page 28: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Authentication: MAC

Similar to HMAC (uses concatenation instead of EXOR)

Hash(MAC_secret_key || pad2 ||hash(MAC_secret_key || pad1 || seqNum || SSLcompressed.type ||SSLcompressed.length ||SSLcompressed.fragment))

– pad1=0x36 repeated 48 times (MD5); 40 times (SHA-1)

– pad2=0x5C repeated …– SSLcompressed.type = high level protocol used to

process segment

28April 2010 CNS & SiReSI

Page 29: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

encoding methods

• segment into blocks of 214 = 16384 bytes• compression (optional):

– must be no lossy and must guarantee to reduce pack size

– default in SSLv3 : no compression• MAC computation (see previous slide)

– on compressed data• several (symmetric) encryption methods:

– block ciphers: IDEA (128) RC2-40, DES-40, DES (56), 3DES (168),

– Stream Cipher: RC4-40, RC4-128– Smart card: Fortezza

29April 2010 CNS & SiReSI

Page 30: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL - record

30

fields of the header

April 2010 CNS & SiReSI

Page 31: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

fields

• Content Type (8 bits)– The higher layer protocol used to process the enclosed

fragment (change_cipher_spec, alert, handshake, and application_data. The first three are the SSL-specific protocols; no distinction is made among the various applications (e.g., HTTP) that might use SSL)

• Major Version (8 bits)– Indicates major version of SSL in use. For SSLv3, the

value is 3• Minor Version (8 bits)

– Indicates minor version in use. For SSLv3, the value is O

• Compressed Length (16 bits)– The length in bytes of the plaintext fragment (or

compressed fragment if compression is used).31April 2010 CNS & SiReSI

Page 32: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL - Payload

32April 2010 CNS & SiReSI

Page 33: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL Change Cipher Spec Protocol

• one of 3 SSL specific protocols which use the SSL Record protocol

• a single message

• to cause the pending state to be copied into the current state, which updates the cipher suite to be used on this connection

• usually sent just after handshaking

33April 2010 CNS & SiReSI

Page 34: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL Alert Protocol

• conveys SSL-related alerts to peer entity

• severity• two possibilities: warning or fatal (close connection)

• specific alert• fatal: unexpected message, bad record mac,

decompression failure, handshake failure, illegal parameter

• warning: close notify, no certificate, bad certificate, unsupported certificate, certificate revoked, certificate expired, certificate unknown

• compressed & encrypted like all SSL data

34April 2010 CNS & SiReSI

Page 35: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL Handshake Protocol

Most complex part of SSL• allows server & client to:

– authenticate each other– to negotiate encryption & MAC algorithms– to negotiate cryptographic keys to be used

• comprises a series of messages in phases– Establish Security Capabilities– Server Authentication and Key Exchange– Client Authentication and Key Exchange– Finish

35April 2010 CNS & SiReSI

Page 36: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SS

L H

andsh

ake

Prot

ocol

36April 2010 CNS & SiReSI

Page 37: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Handshake protocol

4 steps 1. Hello: determine security capabilities 2. Server sends certificate, asks for

certificate and starts exchange session keys3. Client sends certificate and continues

exchanges of keys4. End of handshake protocol: encoded methods

changes Note: some requests are optional

clear separation between handshake and the rest (to avoid attacks)

37April 2010 CNS & SiReSI

Page 38: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Handshake: parameters

message type parameters

Hello-request null

Client-hello version, 32-bit timestamp + 28 random bytes (nonce, i.e. number used once), sessionID, cipher suite and compression method

Server_hello <same as Client_hello>

Certificate X.509v3 chain of certificates

Server_key_exchange info, signature of mess.

Certificate_request type of cert., authority

Server_done null

Certificate_verify signature of certificate

Client_key_exchange info, signature of mess.

Finished hash of all exchanged messages (integrity of handshake protocol) 38April 2010 CNS & SiReSI

Page 39: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Handshake Protocol - step 1

Initialization : Client_hello: client to server

– Version = highest SSL version used by client– 32-bit timestamp + 28 bytes random (a pseudo number

generator is required)– sessionID: = 0 new connection in new session; ≠0 update

previous connection – Cipher suite: list that contains the combinations of

cryptographic algorithms supported by the client, in decreasing order of preference. Each element of the list (each cipher suite) defines both a key exchange algorithm and a CipherSpec.

– Compression algorithms: ordered sequence of acceptable algorithms

: Server_hello: server to client– ack all above (if sessionID of client = 0 generates new

sessionID)39April 2010 CNS & SiReSI

Page 40: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Cipher suite

Algorithms for key exchangeRSA : session key is encoded with server public keyDiffie-Hellman (several versions)

FixedEphemeralAnonymous

Fortezza

CipherSpecCrypto algorithm (either a stream algo or a block algo)MAC algorithmHash (in byte): 0, 16 (for MD5), 20 (for SHA-1)Key material – info used to generate session keysInfo for initializing CBC (initial vector)

40April 2010 CNS & SiReSI

Page 41: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Fixed Diffie-Hellman

• Diffie-Hellman key exchange in which server's certificate contains Diffie-Hellman public parameters signed by the certificate authority (CA).

• Client provides its Diffie-Hellman public key parameters either in a certificate, if client authentication is required, or in a key exchange message.

• This method results in a fixed secret key between two peers, based on the Diffie-Hellman calculation using the fixed public keys.

41April 2010 CNS & SiReSI

Page 42: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Ephemeral Diffie-Hellman

• Used to create ephemeral (temporary, one-time) secret keys. In this case, the Diffie-Hellman public keys are exchanged, signed using the sender's private RSA or DSS key.

• The receiver can use the corresponding public key to verify the signature. Certificates are used to authenticate the public keys.

• This would appear to be the most secure of the three Diffie-Hellman options because it results in a temporary, authenticated key.

April 2010 CNS & SiReSI 42

Page 43: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Anonymous Diffie-Hellman

• The base Diffie-Hellman algorithm is used, with no authentication.

• Each side sends its public Diffie-Hellman parameters to the other, with no authentication. This approach is vulnerable to man-in-the-middle attacks, in which the attacker conducts anonymous Diffie-Hellman with both parties.

April 2010 CNS & SiReSI 43

Page 44: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Handshake Protocol - step 2

Server authentication and key exchangeServer to client

Certificate: X.509 certificate chain (optional)Server_key_exchange (optional)

a signature is created by taking the hash of a message and encrypting it with the sender's private key. In this case the hash is defined as

hash(ClientHello.random || ServerHello.random || ServerParams)

So the hash covers also the two nonces from the initial hello messages.

Certificate_request: (optional)Server_hello_done: I am done and I wait for answers

44April 2010 CNS & SiReSI

Page 45: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Certificate message

• The server begins this phase by sending its certificate, if it needs to be authenticated; the message contains one or a chain of X.509 certificates.

• The certificate message is required for any agreed-on key exchange method except anonymous Diffie-Hellman. – If fixed Diffie-Hellman is used, this

certificate message functions as the server's key exchange message because it contains the server's public Diffie- Hellman parameters.

45April 2010 CNS & SiReSI

Page 46: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

server_key_exchange not needed

A server_key_exchange message is not required in two instances:

(1) The server has sent a certificate with fixed Diffie-Hellman parameters, or

(2) RSA key exchange is to be used.

46April 2010 CNS & SiReSI

Page 47: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

server_key_exchange needed• Anonymous Diffie-Hellman. Message content consists

of the two global D.H. values (a prime number and a primitive root of that number) plus the server's public D.H. key

• Ephemeral Diffie-Hellman. Message content includes the three D.H. parameters provided for anonymous D.H. plus a signature of those parameters.

• RSA key exchange, in which the server is using RSA but has a signature-only RSA key. Server creates a temporary RSA public/private key pair and use server_key_exchange message to send public key. Message content includes the two parameters of the temporary RSA public key (exponent and modulus) plus a signature of those parameters.

47

Page 48: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Handshake Protocol - step 3

Client authentication • Client verifies server certificates and

parameters• Client to server

Client Certificate and info to verify it: (if asked)Message for key exchange (Client_key_exchange)

48April 2010 CNS & SiReSI

Page 49: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Handshake Protocol - step 4

End: go to next phase, cipher_specClient to server

Message: Change_cipher_specFinished message under new algorithms, keys (new

cipher_spec)

Server sends backMessage: Change_cipher_specFinished message under new algorithms, keys (new

cipher_spec)

49April 2010 CNS & SiReSI

Page 50: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SSL & TLS

• IETF standard RFC 2246 similar to SSLv3• with minor differences

– in record format version number– uses HMAC for MAC– a pseudo-random function expands secrets– has additional alert codes– some changes in supported ciphers– changes in certificate negotiations– changes in use of padding

50April 2010 CNS & SiReSI

Page 51: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Paying in the Web: SSL

• SSL and credit card are used for paying– simple– no need of specialized software– compliant with credit card mechanisms– most used method for paying in the web

• Problems– malicious sellers have info on clients– clients can in principle refuse to pay (there is

no signature) – many disputes (20%- 60%)– expensive method for the shop

April 2010 CNS & SiReSI 51

Page 52: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Secure Electronic Transactions (SET)

• open encryption & security specification• to protect Internet credit card

transactions• developed in 1996 by Mastercard, Visa etc• not a payment system• rather a set of security protocols &

formats– secure communications amongst parties– trust from use of X.509v3 certificates– privacy by restricted info to those who need it

April 2010 CNS & SiReSI 52

Page 53: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

components 1

• Cardholder: Purchasers interact with merchants from personal computers over the Internet. A cardholder is an authorized holder of a payment card (e.g., MasterCard, Visa) that has been issued by an issuer.

• Merchant: Person/organization that has goods or services to sell to cardholders, offered via a Web site or by electronic mail. A merchant that accepts payment cards must have a relationship with an acquirer.

April 2010 CNS & SiReSI 53

Page 54: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

components 2

• Issuer: Financial institution that provides the cardholder with the payment card. Ultimately, it is the issuer that is responsible for the payment of the debt of the cardholder.

• Acquirer: Financial institution that establishes an account with a merchant and processes authorizations (card account must be active and proposed purchase does not exceed credit limit) and payments (electronic transfer of payments to merchant's account). Subsequently, acquirer is reimbursed by issuer over some sort of payment network for electronic funds transfer.

April 2010 CNS & SiReSI 54

Page 55: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

components 3

• Payment gateway: Function operated by acquirer or a designated third party that processes merchant payment messages. It interfaces between SET and the existing bankcard payment networks for authorization and payment functions. The merchant exchanges SET messages with the payment gateway over the Internet, while the payment gateway has some direct or network connection to the acquirer's financial processing system.

• Certification authority (CA): Entity that is trusted to issue X.509v3 public-key certificates for cardholders, merchants and payment gateways. A hierarchy of CAs is used, so that participants need not be directly certified by a root authority.

55April 2010 CNS & SiReSI

Page 56: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SET Components

April 2010 CNS & SiReSI 56

Page 57: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SET Transaction

1. customer opens account2. customer receives a certificate3. merchants have their own certificates4. customer places an order5. merchant is verified6. order and payment are sent7. merchant requests payment authorization8. merchant confirms order9. merchant provides goods or service10.merchant requests paymentApril 2010 CNS & SiReSI 57

Page 58: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

transactions 1

1. The customer opens an account. Customer obtains credit card account (e.g., MasterCard or Visa) with a bank that supports electronic payment and SET.

2. The customer receives a certificate. After suitable verification of identity, customer receives an X509v3 digital certificate, signed by the bank. Certificate verifies the customer's RSA public key and its expiration date. It also establishes a relationship, guaranteed by the bank, between customer's key pair and credit card.

58April 2010 CNS & SiReSI

Page 59: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

transactions 2

3. Merchants have their own certificates. Merchant accepting a brand of card must be in possession of two certificates for two public keys owned by the merchant: one for signing messages, and one for key exchange. The merchant also needs a copy of the payment gateway's public-key certificate.

4. Customer places order. Customer (possibly) browses through merchant's Web site to select items and see prices. Customer then sends list of items to be purchased to the merchant, who returns an order form containing the list of items, their price, a total price, and an order number.

59April 2010 CNS & SiReSI

Page 60: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

transactions 3

5. Merchant is verified. Merchant also sends a copy of its certificate, so that customer can verify about dealing with a valid store.

6. Order and payment are sent. Customer sends both order and payment information to merchant, along with certificate. Order confirms the purchase of the items in the order form. Payment contains credit card details. Payment information is encrypted and cannot be read by merchant.

7. Merchant requests payment authorization. Merchant sends payment information to payment gateway, requesting authorization.

60April 2010 CNS & SiReSI

Page 61: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

transactions 4

8. Merchant confirms the order. Merchant sends confirmation of the order to customer.

9. Merchant provides the goods or service. Merchant ships the goods or provides the service to customer.

10.Merchant requests payment. Request is sent to the payment gateway, which handles all of the payment processing.

61April 2010 CNS & SiReSI

Page 62: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Dual Signature

• customer creates dual messages– order information (OI) for merchant

– payment information (PI) for bank

• neither party needs details of other

• but must know they are linked

• use a dual signature for this– signed concatenated hashes of OI & PI

62April 2010 CNS & SiReSI

Page 63: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

dual signature schema

63April 2010 CNS & SiReSI

Page 64: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SET transaction types 1/4

64

transaction type info

Cardholder registration

Cardholders must register with a CA before they can send SET messages to merchants.

Merchant registration

Merchants must register with a CA before they can exchange SET messages with customers and payment gateways.

Purchase request Message from customer to merchant containing OI for merchant and PI for bank.

Payment authorization

Exchange between merchant and payment gateway to authorize a given amount for a purchase on a given credit card account.

Payment capture Allows the merchant to request payment from the payment gateway.

April 2010 CNS & SiReSI

Page 65: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SET transaction types 2/4

65

transaction type info

Certificate inquiry and status

If the CA is unable to complete the processing of a certificate request quickly, it will send a reply to the cardholder or merchant indicating that the requester should check back later. The cardholder or merchant sends the Certificate Inquiry message to determine the status of the certificate request and to receive the certificate if the request has been approved.

Purchase inquiry Allows the cardholder to check the status of the processing of an order after the purchase response has been received. Note that this message does not include information such as the status of back-ordered goods but does indicate the status of authorization, capture, and credit processing.

April 2010 CNS & SiReSI

Page 66: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SET transaction types 3/4

66

transaction type info

Authorization reversal

Allows a merchant to correct previous authorization requests. If the order will not be completed, the merchant reverses the entire authorization. If part of the order will not be completed, the merchant reverses part of the amount of the authorization.

Capture reversal Allows a merchant to correct errors in capture requests such as transaction amounts that were entered incorrectly by a clerk.

Credit Allows a merchant to issue a credit to a cardholder's account such as when goods are returned or were damaged during shipping. Note that the SET Credit message is airways initiated by the merchant, not the cardholder. All communications between the cardholder and merchant that result in a credit being processed happen outside of SET.

April 2010 CNS & SiReSI

Page 67: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

SET transaction types 4/4

67

transaction type info

Credit reversal Allows a merchant to correct a previously request credit.

Payment gatewayrequest

Allows a merchant to query the payment gateway and receive a copy of the gateway's current key exchange and signature certificates.

Batch administration

Allows a merchant to communicate information to the payment gateway regarding merchant batches.

Error message Indicates that a responder rejects a message because it fails format or content verification tests.

April 2010 CNS & SiReSI

Page 68: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Purchase Request – Customer

68

merchant doesn’t know KS

generated by customer

needed for verification

April 2010 CNS & SiReSI

Page 69: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Purchase Request – Merchant

69April 2010 CNS & SiReSI

Page 70: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Purchase Request – Merchant

1. verifies cardholder certificates using CA sigs2. verifies dual signature using customer's public

signature key to ensure order has not been tampered with in transit & that it was signed using cardholder's private signature key

3. processes order and forwards the payment information to the payment gateway for authorization (see next)

4. sends a purchase response to cardholder

70April 2010 CNS & SiReSI

Page 71: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Payment Gateway Authorization

1. verifies all certificates2. decrypts digital envelope of authorization block to obtain

symmetric key & then decrypts authorization block3. verifies merchant's signature on authorization block4. decrypts digital envelope of payment block to obtain symmetric

key & then decrypts payment block5. verifies dual signature on payment block6. verifies that transaction ID received from merchant matches

that in PI received (indirectly) from customer7. requests & receives an authorization from issuer8. sends authorization response back to merchant

71April 2010 CNS & SiReSI

Page 72: Cryptography and Network Security Sicurezza delle reti e ...damore/sicu/slide/slide2010/ssl-tsl.pdf · Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici

Payment Capture

• merchant sends payment gateway a payment capture request

• gateway checks request

• then causes funds to be transferred to merchants account

• notifies merchant using capture response

72April 2010 CNS & SiReSI