SSL TCPIP Application HTTP SSL TCP IP IP

  • Slides: 30
Download presentation

SSL과 TCP/IP Application HTTP SSL TCP IP IP 일반적인 응용 SSL을 사용한 응용 •

SSL과 TCP/IP Application HTTP SSL TCP IP IP 일반적인 응용 SSL을 사용한 응용 • SSL은 응용 프로그램에 API를 제공한다. • C와 Java SSL libraries/classes가 제공된다. 12

Diffie-Hellman 키 교환 알고리즘 r 공개된 값들: m 큰 값의 소수 p, generator g

Diffie-Hellman 키 교환 알고리즘 r 공개된 값들: m 큰 값의 소수 p, generator g (primitive root of p) r Alice의 비밀값: a, Bob의 비밀값: b r A B: ga (mod p) r B A: gb (mod p) r Bob의 계산: (ga)b = gab (mod p) r Alice의 계산: (gb)a = gab (mod p) r 대칭키 = gab (mod p)

SSL: Handshake (2) 1. 2. 3. 4. 5. 6. C -> S: crypto algorithms의

SSL: Handshake (2) 1. 2. 3. 4. 5. 6. C -> S: crypto algorithms의 종류, client nonce (Rc) S -> C: 선택한 알고리즘 + 인증서 + server nonce (Rs) C: 인증서(certificate)를 검증, server의 공개키를 추 출, pre_master_secret을 생성하여 server의 공개키 로 암호화하여 server에 보낸다. C와 S: 각자 pre_master_secret과 nonces를 사용하 여 encryption과 MAC key를 계산한다. C: 모든 handshake 메시지에 MAC를 첨부하여 보낸 다. S: 모든 handshake 메시지에 MAC를 첨부하여 보낸 다. 21

crypto algorithms의 협상 r Cipher spec m Cipher Algorithm (RC 4, RC 2, DES,

crypto algorithms의 협상 r Cipher spec m Cipher Algorithm (RC 4, RC 2, DES, 3 DES, DES 40, IDEA) m MAC Algorithm (MD 5, SHA-1) m Cipher Type (stream or block) m Is Exportable (true or false) m Hash size (0 or 16 bytes for MD 5, 20 bytes for SHA-1) m IV size: IV size for Cipher Block Chaining(CBC) encryption 22

SSL 레코드 구성 data fragment record header data fragment MAC encrypted data and MAC

SSL 레코드 구성 data fragment record header data fragment MAC encrypted data and MAC record header: {content type; version; length} MAC: MAC(Mx, sequence number||type||data) Note: no sequence number field Fragment: each SSL fragment 214 bytes (~16 Kbytes) 26

SSL 레코드 형식 1 byte content type 2 bytes 3 bytes SSL version length

SSL 레코드 형식 1 byte content type 2 bytes 3 bytes SSL version length data MAC Data와 MAC은 대칭키 알고리즘으로 암호화 27

Type와 Seq number의 사용 hello ce certificate, non KB +(MS) = EMS type 0,

Type와 Seq number의 사용 hello ce certificate, non KB +(MS) = EMS type 0, seq 1, data encrypted type 0, seq 2, data bob. com ata d , 1 q e s , type 0, seq 3, data type 1, seq 4, close type 1, seq 2 28

SSL 예 RA RB {g, p, g. B} g. A handshake: Client. Hel lo

SSL 예 RA RB {g, p, g. B} g. A handshake: Client. Hel lo (RA) r. Hello (R B) e v r e S : e k handsha p, g. B} , g { e t a ic : Certif handshake Hello. Done r e v r e S : e handshake: Client. Key Exchange {g. A} Change. Cipher. Sp ec RA RB {g, p, g. B} g. A Finished 여기서부터 암호화 시작 r. Spec Change. Ciphe Finished application_data application_d Alert: warning, close_ notify 29

키 계산 r 앞의 경우: {g, p, g. A, g. B}에서 pre-master secret 계산

키 계산 r 앞의 경우: {g, p, g. A, g. B}에서 pre-master secret 계산 r Pre-master secret에서 master secret 계산 r Client nonce(RA), server nonce(RB), master secret 에서 다음의 4개의 key와 2개의 IV값을 계산한다. m m m client MAC key server MAC key client encryption key server encryption key client initialization vector (IV) server initialization vector (IV) 30