algorithm types and modes

31
Algorithm Types and Modes Electronic Codebook Mode Block Replay Cipher Block Chaining Mode Stream Ciphers Self-Synchronizing Stream Ciphers Cipher-Feedback Mode Synchronous Stream Ciphers

Upload: randall-hampton

Post on 03-Jan-2016

36 views

Category:

Documents


3 download

DESCRIPTION

Algorithm Types and Modes. Electronic Codebook Mode Block Replay Cipher Block Chaining Mode Stream Ciphers Self-Synchronizing Stream Ciphers Cipher-Feedback Mode Synchronous Stream Ciphers. Algorithm Types and Modes. Output-Feedback Mode Counter Mode Other Block-Cipher Modes - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Algorithm Types and Modes

Algorithm Types and Modes

Electronic Codebook Mode Block Replay Cipher Block Chaining Mode Stream Ciphers Self-Synchronizing Stream Ciphers Cipher-Feedback Mode Synchronous Stream Ciphers

Page 2: Algorithm Types and Modes

Algorithm Types and Modes

Output-Feedback Mode Counter Mode Other Block-Cipher Modes Choosing A Cipher Mode Interleaving Block Ciphers VS Stream Cipher

Page 3: Algorithm Types and Modes

Electronic Codebook Mode(1/2)

Block cipher 를 사용하는데 가장 명확한 방법 Plaintexts 와 CipherTexts 의 관계에서 CodeBook 을

생성 ( 키마다 다른 codebook 을 가진다 .) 파일을 linear 하게 암호화 할 필요는 없다 . 여러 암호 processor 를 가지고 있다면 병렬처리 단점 : key 를 모르는 상태에서 codebook 을 구성 가능하다 .

( 해독자가 여러 평문과 암호문을 가지고 있다면 ) Stereotyped beginnings and Stereotyped endings

Page 4: Algorithm Types and Modes

Electronic Codebook Mode(2/2)

Padding 대부분의 msg 가 64bit 로 나누어 떨어지지 않는다 .

마지막 block 에 일정한 패턴을 집어 넣는다 .

Ciphertext stealing

Page 5: Algorithm Types and Modes

Block Replay

Key 나 알고리즘을 모르는 상대가 암호화된 msg 를 변경할 수 있다 .

Communication line 에서 암호화된 msg 를 record. A pair of identical msg 을 찾는다 .

자신의 communication 에서 msg 를 insert 한다 . Timestamp 로 막을 수 있다 .(not complete) fundamental problem 이다 . Solution 은 chaining 기법을 이용

Page 6: Algorithm Types and Modes

Cipher Block Chaining Mode(1/6)

Chaining : 블록 암호에 feedback 을 도입 평문 블록을 이전 암호 블록과 XOR 시킨다 . 각 블록의 암호는 모든 이전 블록에 의존한다 . Ci=Ek(Pi xor Ci-1)

Pi= Ci-1 xor Dk(Ci)

Page 7: Algorithm Types and Modes

Cipher Block Chaining Mode(2/6)

Page 8: Algorithm Types and Modes

Cipher Block Chaining Mode(3/6)

Initialization Vector 동일한 header 는 어떤 유용한 정보를 가진다 .

이것은 해독자에게 유용한 정보를 줄 수가 있다 .

첫 번째 블록을 임의의 data 로 암호화해서 방지한다 . 이 임의의 data 블록을 IV 라 한다 .

동일한 평문 msg 는 다른 암호문 msg 로 암호화 (code book 만들기가 어려워진다 .)

Page 9: Algorithm Types and Modes

Cipher Block Chaining Mode(4/6)

Padding ECB mode 와 같이 동작하지만 , 어떤 application

에서는 암호문과 평문의 사이즈가 같아야 한다 .

Page 10: Algorithm Types and Modes

Cipher Block Chaining Mode(5/6)

Error Propagation 평문에서 1-bit error 는 암호화 해서 해독된 평문에서도

1-bit error 를 가진다 .( 암호화된 연속 block 에 영향 )

암호문에서의 error 가 더 일반적 .

통신상의 noisy 와 중간 저장장치에서 malfunction.

In CBC mode, 암호문의 1-bit error 는 한 블록과 재생된 평문의 1-bit 에 영향을 미친다 .( 연속되는 한 블록도 같은 위치에 1-bit error 를 가진다 .)

Error extension

Page 11: Algorithm Types and Modes

Cipher Block Chaining Mode(6/6)

Security Problems CBC 의 구조에 의해서 발생 암호블록은 다음 블록에 영향을 미친다 . 암호화된

msg 의 끝에 블록을 더할 수 있다 . 쓰레기 data 로 해독될 것이지만 바람직 하지 않다 .

1. 평문을 구성할 때 msg 를 끝나는 곳을 알 수 있게 해서 추가가 블록을 찾을 낼 수 있게 한다 .

2. 전체 평문 msg 는 controlled redundancy or authentication 을 가진다 .

3. 매우 긴 msg 의 경우 pattern 을 가진다 .

Page 12: Algorithm Types and Modes

Stream Ciphers

평문을 1bit 씩 암호문으로 바꾼다 .ci=pi xor ki

pi = ci xor ki

pi xor ki xor ki = pi

Page 13: Algorithm Types and Modes

Self-Synchronizing Stream Ciphers (1/2) 각 keystream bit 는 이전 ciphertext bit 의

고정된 수의 함수이다 .

Internal state 는 이전 암호 n-bit 의 함수이다 .

각 msg 는 임의의 n-bit 길이의 header 를 가진다 .

Page 14: Algorithm Types and Modes

Self-Synchronizing Stream Ciphers(2/2) Security Problems

playback attack 에 약하다 .

Mallory 가 암호 bit 를 기록하고 , 나중에 current traffic 으로 recording 으로 대체한다 .

초기 garbage 후에 받는 쪽이 resynch 하는 동안 예전의 암호문은 보통값으로 해독된다 .

받는 쪽은 이것이 current data 라는 것을 알 수 없고 예전 data 는 replay 된다 .

따라서 resynch 가 자주 발생하는 문제

Page 15: Algorithm Types and Modes

Cipher-Feedback Mode(1/3)

CBC mode 와 같이 data 의 완전한 block 을 받을 때까지 encryption 을 하지 않는다 .

Data 는 block size 보다 작은 units 로 암호화된다 .

n-bit CFB 를 사용한다 .( 블록 size 보다는 같거나 작은 크기 )

Page 16: Algorithm Types and Modes

Cipher-Feedback Mode(2/3)

Initialization Vector block 알고리즘에 input 은 IV 로 초기화 CBC mode 의 IV 와 유사 (need not be secret)

Unique 해야 한다 .(CBC mode 의 IV 와의 차이점 )

Unique 하지 않으면 해독자가 plaintext 를 recover 가능 Msg 마다 바뀌어야 한다 .

Page 17: Algorithm Types and Modes

Cipher-Feedback Mode (3/3)

Error Propagation 평문에서 error 는 모든 다음 암호문에 영향을 미친다 .

암호문에서 1bit error 는 plaintext 에서 1bit 에러를 발생시킨다 .

error 가 Shift register 에 들어 있다면 , register 의 다른 끝까지 갈 때까지 garbled 된다 .

m/(n-1) 블록에 영향 (m 은 블록 size,n 은 n-bit CFB mode)

Page 18: Algorithm Types and Modes

Synchronous Stream Ciphers(1/3)

Keystream 은 Msg 의 stream 에 독립적으로 발생 synchronous ciphers 는 transmission error 를

propagate 하지 않는다 . Keystream generator 는 long period 를 가져야 한다 . Insertion 과 deletion 을 막을 수 있다 .

Page 19: Algorithm Types and Modes

Synchronous Stream Ciphers(2/3)

Insertion Attack Mallory ciphertext stream 을 기록했지만 , plaintext 와

암호화 하는데 사용한 keystream 은 모르고 있다 .

Original plaintext : p1 p2 p3 p4 …Original keystream: k1 k2 k3 k4 …Original ciphertext: c1 c2 c3 c4 ..

New plaintext : p1 p` p3 p4 …Original keystream: k1 k2 k3 k4 …Updated ciphertext: c1 c`2 c`3 c`4 ...

P` 를 p1 뒤에 넣는다 . 새로운 암호문을 기록

Page 20: Algorithm Types and Modes

Synchronous Stream Ciphers(3/3)

k2=c`2 xor p`, and then p2 = c2 xor k2

k3=c`3 xor p2, and then p3 = c3 xor k3

k4=c`4 xor p3, and then p4 = c4 xor k4

P` 의 값을 알고 있다면 , 원래의 암호문과 새로운 암호문 후에 전체적인 plaintext 를 결정

Bit 가 삽입된 위치를 정확히 알지 못해도 2 개의 암호문을 비교해서 달라지기 시작한 부분을 알아낸다 .해결방안 : 2 개의 다른 msg 를 암호화 할 때 같은 keystream 을 사용하지 않는다 .

Page 21: Algorithm Types and Modes

Output-Feedback Mode(1/2) CFB mode 와 유사 ( 이전의 output block 의 n-bit 가 큐의

가장 오른쪽 위치로 이동한다는 것만 제외 )

n-bit OFB(n 은 블록 size, Si 는 state)

Ci=Pi xor Si; Si=Ek(Si-1)

Pi=Ci xor Si; Si=Ek(Si-1)

대부분의 작업이 offline 으로 이루어질 수 있다 .

Page 22: Algorithm Types and Modes

Output-Feedback Mode(2/2)

Error Propagation no error extension ciphertext 에서 1bit error 는 재생된 plaintext 에서

1bit error 를 일으킨다 . (digitized analog transmission)

a loss of synchronization 는 치명적 Security Problems with OFB feedback size 가 block size 와 같아야 한다 . Stream Ciphers in OFB key 가 next-state function 에 영향 Complexity 는 next-state function 에 있다 .

Page 23: Algorithm Types and Modes

Counter Mode

Counter mode 에서 block cipher 는 input 으로서 sequence number 를 사용한다 .

Register 에 대한 input 으로 counter 를 사용synchronization 와 error propagation 은 OFB 와 동일 Stream Ciphers in Counter Mode simple next-state function 을 가지고 , key 에 의존하는

복잡한 output function 을 가진다 .

먼저 모든 이전 key bit 을 생성하기 전에 i 번째 key bit 을 생성 가능하다 .

특정 블록의 decryption 이 가능하다 .

Page 24: Algorithm Types and Modes

Other Block-cipher Modes(1/5)

Block Chaining Mode Ci=Ek(Pi xor Fi); Fi+1=Fi xor Ci

Pi=Fi xor Dk(Ci); Fi+1=Fi xor Ci

문제점 : decryption of ciphertext block 은 모든 이전 ciphertext block 에 의존

Propagating Cipher Block Chaining Mode CBC 와 유사 (encryption 하기 전에 이전 plaintext

block 과 이전 ciphertext block 이 현재의 plaintext블록과 XOR 한다 .)

Page 25: Algorithm Types and Modes

Other Block-cipher Modes(2/5)

Propagating cipher block chaining mode

Page 26: Algorithm Types and Modes

Other Block-cipher Modes (3/5)

Ci=Ek(Pi xor Ci-1 xor Pi-1)

Pi= Ci-1 xor Pi-1 xor Dk(Ci)

ciphertext 에 error 는 뒤따르는 모든 block 이 잘못된 decryption 을 하게 한다 .

msg 의 끝에 block 을 checking 은 전체 msg 의 integrity를 확신 시켜준다 .

Cipher Block Chaining with Checksum CBC 의 변종 모든 plaintext block 의 XOR 을 유지 , 마지막 plaintext

block 과 그것을 XOR 시킨다 .

Page 27: Algorithm Types and Modes

Other Block-cipher Modes (4/5)

마지막 block 이 integrity check 나 constant 를 포함한다면 해독된 plaintext 의 integrity 는 적은 추가 overhead 로 check 가 가능 .

Output Feedback with a Nonlinear Fucntion OFB 와 ECB 의 변종 Ci=Eki(Pi); Ki=Ek(Ki-1)

Pi=Dkj(Ci); Ki=Ek(Ki-1)

ciphertext 에서 한 bit error 는 단지 하나의 plaintext block 에 propagate 된다 . 그러나 추가되거나 없어지면 infinite error extension 이 된다 .

Page 28: Algorithm Types and Modes

Other Block-cipher Modes (5/5)

More Mode

Plaintext block chaining(PBC)

Plaintext feedback (PFB)

cipher block chaining of plaintext difference(CBCPD)

Page 29: Algorithm Types and Modes

Choosing A Cipher Mode

ECB speed, simplicity, easy, fast, weakness

CBC encrypting files, security, bit errors in stored data, almost

never synch error. Best choice in software-based app. CFB encrypting a streams of character(host-terminal), high speed

synch system, OFB in error prone environment(no error extension)

Page 30: Algorithm Types and Modes

Interleaving

Parallel encryption 을 가능하게 한다 .각 stream 은 자신의 IV 를 필요로 한다 .

Page 31: Algorithm Types and Modes

Block Ciphers VS Stream Ciphers

Block Ciphers Operate on data with a fixed transformation on large blocks

of plain-text data.

More general

easier to implement in software

Stream Ciphers Operate with a time-varying transformation on individual

plaintext digits

easier to analyze mathematically

suitable for hardware implementation