1 / 21

대칭알고리즘 AES

대칭알고리즘 AES. ▪ 발표자 : 최명현. DES challenge. AES (Advanced Encryption Standard). AES Pseudo. AES(in,out,key) { KeyExpansion(Key,RoundKey) state = in AddRoundKey (state,RoundKey[0]) for round=1 step 1 to Nr-1 SubBytes(stats) ShiftRows(stats)

myra-greer
Télécharger la présentation

대칭알고리즘 AES

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 대칭알고리즘AES ▪ 발표자 : 최명현

  2. DES challenge

  3. AES (Advanced Encryption Standard)

  4. AES Pseudo AES(in,out,key) { KeyExpansion(Key,RoundKey) state = in AddRoundKey (state,RoundKey[0]) for round=1 step 1 to Nr-1 SubBytes(stats) ShiftRows(stats) MixColumns(stats) AddRoundKey(stats,RoundKey[i] end for SubBytes(stats) ShiftRows(stats) AddRoundKey(stats,RoundKeyp[Nr]) out = stats }

  5. 암호화 복호화 Smplified Rijndael Scheme

  6. Nr : rounds Nb : block size / 32bit Nk : key size / 32bit Nr Nb=4 Nb=6 Nb=8 Nk=4 10 12 14 Nk=6 12 12 14 Nk=8 14 14 14 Rijndeal Structure • 블록사이즈 : 128 비트 , 키 사이즈 : 128/192/256 비트 • 구조 : 10 / 12 / 14 라운드의 SPN 구조 - Byte 단위의 연산을 이용 - 세개의 layer로 구성

  7. State • Rijndael 연산들은 상태(state)라고 하는 2차원 바이트배열에 수행된다 • State는 2차원 배열로 구성된다.행은 4행으로 구성되고 , 각 행은 Nb 바이트로 구성된다 . Nb =4 일때의 block state 와 Nk = 4 일때의 key state ex) 128비트 입력 : EA 83 5C F0 04 45 33 2D 65 5D 98 AD 85 96 B0 C5

  8. GF(28)에서 곱셈에 대한 역원 ◈곱셈에 대한 역원 찾기 만약 GCD(d,f)=1이라면 그때 d는 modulo f 상에서 곱셈에 대한 역원을 갖는다. 양의 정수 d<f에 대해, dd-1=1 mod f인 d-1<f가 존재 • Extended Euclid(d,f) 1. (X1, X2, X3)<-(1,0,f);(Y1, Y2, Y3)<-(0,1,d) 2. If X3= 0 return X3=GCD(d,f); no inverse 3. If X3 = 1 return Y3=GCD(d,f); Y2=d-1 mod f 4. Q = X3 /Y3 5. (T1, T2, T3) <- (X1-QY1, X2-QY2, X3-QY3) 6. (X1, X2, X3) <- (Y1, Y2, Y3) 7. (Y1, Y2, Y3) <- (T1, T2, T3) 8. Goto 2

  9. GF(28)에서 곱셈에 대한 역원 ex) GF(28) 에서 95의 곱셈에 대한 역구하기 GCD(95,m(x))=1 m(x)=x8 +x4 +x3+x+1 b(x)=x7 +x4 +x2+1 A1(x)=1 , A2(x)=0 , A3(x) = x8 +x4 +x3+x+1 B1(x)=0 , B2(x)=1 , B3(x) = x7 +x4 +x2+1 1.Q(x)=(x8 +x4 +x3+x+1) /(x7 +x4 +x2+1) = x [T1,T2,T3]<-[1-x·0 ,0-x·1 , (x8 +x4 +x3+x+1) –x·(x7 +x4 +x2+1)] A1(x)=0 A2(x)=1 A3(x)=x7 +x4 +x2+1 B1(x)=1 B2(x)=x B3(x)=x5 +x4+1 2.Q(x)= (x7 +x4 +x2+1) / (x5 +x4+1) = x2 +x+1 [T1,T2,T3]<-[0-(x2 +x+1)·1 ,1-(x2 +x+1)·x , (x7 +x4 +x2+1) –(x2 +x+1)·(x5 +x4 +1)] A1(x)=1 A2(x)=x A3(x)=x5 +x4 +1 B1(x)=x2 +x+1 B2(x)=x3+x2 +x+1 B3(x)=x 3.Q(x)=(x5+x4 +1) / x = x4 +x3 [T1,T2,T3]<-[1-(x4 +x3)·(x2 +x+1) ,x-(x4 +x3)·(x3+x2 +x+1) , (x5 +x4 +1) –(x4 +x3)·x] <-[x6 +x3 , x7+x3 +x ,1] A1(x)=x2 +x+1 A2(x)=x3+x2 +x+1 A3(x)=x B1(x)=x6 +x3B2(x)=x7+x3 +x B3(x)=1 B3(x)=1 이므로 B2(x)=B(x)-1 mod m(x) B2(x)=x7+x3 +x = 8A ∴ 95-1 = 8A

  10. Substitute Bytes Transformation ◈ state 의 각 바이트를 치환 • 각 바이트를 16x16 s-box를 이용하여 치환 • 8비트를 상위 4비트가 행, 하위 4비트가 열로 사용.

  11. Substitute Bytes Transformation • S-box()는 기약다항식 m(x) = x8 +x4 +x3+x+1을 사용하여 구성한다. • 구성방법 • 먼저 s-box()에 00,01,...,FF 순으로 초기화 한다. • 이 값들을 GF(28)에서 곱셈에 대한 역원으로 매핑한다. 00 -> 00 • 한 항의 값이 b7b6b5b4b3b2b1b0 이면 다음 식에 의해 변형된다. bi ’=bi ⊕ b(i+4)mod 8 ⊕ b(i+6)mod 8 ⊕ b(i+7)mod 8 ⊕ ci i 를 0 ~ 7까지 대입하여 정리하면 아래식이 나온다 . 그리고 뒤에 63은 임의로 주어진 1 바이트 수 이다 . 95 = 95-1 = 8A

  12. S-box

  13. 0 0 1 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 b´0 b´1 b´2 b´3 b´4 b´5 b´6 b´7 b0 b1 b2 b3 b4 b5 b6 b7 1 0 1 0 0 0 0 0 = + Inverse Substitute Bytes Transformation • Inverse s-box 는 s-box()의 bi ’ =bi ⊕ b(i+4)mod 8 ⊕ b(i+6)mod 8 ⊕ b(i+7)mod 8 ⊕ ci의 역을 적용한 다음 GF(28)에서 곱셈에 대한 역원으로 구성한다. 역변환은 bi ’ = b(i+2)mod 8 ⊕ b(i+5)mod 8 ⊕ b(i+7)mod 8 ⊕ di 이며 바이트 d는 63의 곱셈에 대한 역원인 05 이다.

  14. Inverse S-box

  15. Shift row Transformation • 각행을 행의 index 만큼 왼쪽으로 circular shift 함 .

  16. Mix Column • Mix column에서는 state의 column이 GF()에서의 다항식 a(x)가 고정된 다항식 c(x)에 대해 a(x) ⊕ c(x) mod (x4+1) 연산을 행한다. • c(x) = ’03’ x3 + ’01’ x2 + ’01’ x + ’02’ • d(x) = ’0B’x3 + ’0D’x2 + ’09’x + ’0E’ • m(x) = x4+1 최고차항이 4차 보다 작은 두 다항식 a(x) b(x)가 있다고 가정하면 a(x)= a3x3 +a2x2 +a1x+a0 , b(x)= b3x3 +b2x2 +b1x+b0이다 c(x)= a(x)b(x) 하면 c(x)= c6x6 +c5x5 +c4x4 +c3x3 +c2x2 +c1x1+c0 • c0 = a0•b0 • c1 = a1•b0  a0 •b1 • c2 = a2•b0  a1•b1  a0•b2 • c3 = a3•b0  a2•b1  a1•b2  a0•b3 • c4 = a3•b1  a2•b2  a1•b3 • c5 = a3•b2  a2•b3 • c6 = a3•b3

  17. a0 a3 a2 a1 a1 a0 a3 a2 a2 a1 a0 a3 a3 a2 a1 a0 b0 b1 b2 b3 d0 d1 d2 d3 b0 b1 b2 b3 d0 d1 d2 d3 = = Mix Column c(x)의 최고차항이 4보다 크기때문에 mod m(x) 연산을 해주면 그값은 아래와 같다. c(x)mod m(x)= d(x) = d3x3 +d2x2 +d1x+d0 = c3x3 +c2x2+c6x2 +c1x+c5x+c4 +c0 d0 = a0•b0 a3•b1 a2•b2 a1•b3 d1 = a1•b0 a0•b1 a3•b2 a2•b3 d2 = a2•b0 a1•b1 a0•b2 a3•b3 d3 = a3•b0 a2•b1 a1•b2 a0•b3 위 식을 간단히 하면 아래와 같이 된다. 02 03 01 01 01 02 03 01 01 01 02 03 03 01 01 02

  18. 02 03 01 01 01 02 03 01 01 01 02 03 03 01 01 02 87 6E 46 A6 47 37 94 ED Mix Column =

  19. The round key addition • 라운드 키는 키 스케줄에 의해 생성된 키들과 state의 EXOR 이다.

  20. Key expansion Pseudo code

  21. Key expansion •128 비트 키를 4Nr+4 개의 32비트 워드로 확장

More Related