╱╱╭╮╱╱╱╱╱╱╭━━━╮╱╱╱╭╮╱╭╮╱╱╱╱╱╱ ╱╱┃┃╱╱╱╱╱╱┃╭━╮┃╱╱╱┃┃╱┃┃╱╱╱╱╱╱ ╱╱┃┣━━┳━━╮┃┃╱┃┣━╮╱┃╰━╯┣━━┳━╮╱ ╭╮┃┃╭╮┃┃━┫┃╰━╯┃╭╮╮┃╭━╮┃╭╮┃╭╮╮ ┃╰╯┃╭╮┃┃━┫┃╭━╮┃┃┃┃┃┃╱┃┃╭╮┃┃┃┃ ╰━━┻╯╰┻━━╯╰╯╱╰┻╯╰╯╰╯╱╰┻╯╰┻╯╰╯

CS/정보 보안

[정보 보안] Symmetric Encryption Message Confidentiality (9)

재안안 2024. 6. 22. 19:40


[2] Symmetric Encryption Message Confidentiality
[2-1] Block Cipher Structure
[2-2] Data Encryption Standard


[2] Symmetric Encryption Message Confidentiality
conventional encryption, secret-key or single-key encryption
plaintext, encryption algorithm, secret key, ciphertext, and decryption algorithm

Cryptanalysis
- Only weak algorithms fail a ciphertext-only attack
- Usually design algorithms to withstand a known-plaintext attack

Computationally Secure Algorithms

@Computationally Secure If
- Cost of breaking cipher exceeds info value
- Time required to break cipher exceeds the useful lifetime of the info

[2-1] Block Cipher Structure
- A sequence of round
- Substitutions (permutations controlled by key)

Parameters and design features
- Block size (64, 128, 256)
- Key size (40, 56, 64, 80, 128, 168, 192, 256)
- Number of rounds
- Subkey generation algorithm
- Round function
- Fast software en/decrypt, ease of anlysis

S/P-Network

Feistel Network
- Small change in private key results large change in ciphertext
- Confusion
- Diffusion

@Confusion
- Making the relationship between statistical values for ciphertext and encryption key values

@Diffusion
- Making the statistical relationship between plaintext and ciphertext

Feistel Network-based Encryption and Decryption
1. N-bit block processing
- N-bit plain text -> n-bit ciphertext

2. Number of rounds
- Number of repetitions of Feistel Network
- Last round does not invert

3. Encryption
- Plain text is divided into left and right sides, and the final result LN and RN are ciphered through N round processing
- Using different sub key generated from secret key K each round
- 인풋을 반으로 잘라서 왼쪽 애는 f(subkey_i)랑 xor 연산후 마지막 라운드가 아니라면 왼쪽 오른쪽 교체

@BCS Encryption
- Li = Ri-1
- Ri = Li-1 ^ f(Ri-1, Ki)

4. Decryption
- Same structure with encryption, but input/output are reversed (the keys used are reversed)
- Passing Feistel network twice with the same subkey will result going back to original


[2-2] Data Encryption Standard
A slight change in plaintext or key value will cause a very large change in ciphertext

- Fixed cipher key : change in 1 bit of plain text will result 32 bits of ciphertext change
- Fixed plaintext : change in 1 bit of cipher key will result 32 bits of ciphertext change

- C = DESK(M) -> C' = DESK'(M')

DES Configuration
- 64-bit block cipher with input and output
- Use the same key for encryption and decryption
- IP : 임의로 각 bit의 position을 IP 테이블을 통해 변경
- Block cipher를 16번 반복 (Feistel structure)
- IIP : 아까 변경했던 position에 있는 bit를 원복 (내용 상관x)
- Decryption is processed with the same key, but applied in reverse order

@DES 64-bit
- Input : 64-bit plain text
- Key : 56-bit (seed) + 8-bit (parity)

DES processing step
- Initial Permutation
- Repetition of plain text processing 16 round Feistel structure
- 각 라운드 마다 48 비트의 subkey 생성해서 사용
- 복호화는 적용했던 subkey의 순서를 역으로 진행
- Substitution
- Inverse Initial Permutation

@IP Table and IIP Table
- 각 비트는 어디로 이동하라고 값이 정해져있는 테이블
- 64-bit를 바이트 단위로 우선 쪼개고 
- 각 바이트를 비트 단위로 쪼개서 인덱싱
- Bit transpose

@DES BtoW
- 8바이트를 각 32비트로 나눔
- Left32 |= (UNIT) Plain64[i] << (24 - (i * 8))
- Right32 |= (UNIT) Plain64[i] << (56 - (i * 8))

DES round function
- 32bit를 48bit로 expand
- 4비트 단위로 8덩이를 만들어서
- 각 덩어리마다 양옆에 있는 (다른 덩어리의) 비트를 복사한다
- 덩어리를 모두 합치면 48bit Expansion P-box 생성
- EP 테이블로 정리
- 48bit의 P-box를 48bit의 key와 xor 연산후 (S-box)
- 다시 32bit를 추출 (Straight P-box)
- 비트 마스킹을 통해 EP 테이블의 인덱스를 추출
- 위에서 Expand 했던 비트를 버린다
- 그러면 32bit의 블럭이 만들어진다

DES Round Key Generation
- 64bit Key에서 parity bits를 버리면 56bit의 seed key가 된다
- 각각 28bit의 2 블럭으로 나누고 각 블럭에 Shift Left를 수행한다
- 1, 2, 9, 16라운드에는 왼쪽으로 1bit 씩 돌리고 (순환)
- 아닌 라운드에는 왼쪽으로 2 bit씩 돌린다 (순환)
- 각 라운드 마다 2개의 블럭을 Shift Left한 후 합친 것이 round key이다.

Electronic Codebook
- Encrypt plaintext block by block
- One-to-one relationship on plaintext and ciphertext

Cipher Block Chaining
- Encrypt plaintext by concatenating ciphertext blocks
- Encryption is perfomed by XORing previous ciphertext block and plaintext block
- Since length of plaintext is variable, add padding at last block to fit block length
- Use Initial Vector to different random bit string for each encryption

Cipher Feedback
- Use the preceding ciphertext block as input to encryption algorithm
- Plain text block XOR output of enryption algorithm = ciphertext block

Output Feedback Block
- A plaintext block is not directly encrypted by a cryptographic algorithm
- XOR the output of a plaintext block and cryptographic algorithm.

Counter
- The counter is incremented by 1 to generate a key stream.
- The resulr of XORing the plaintext block with the bit string, encrypted counter, becomes a ciphertext block.
- The initial value of counter is nonce for each encryption.
- CTR mode is a kind of stream cipher such as OFB mode.
- Decryption은 각 counter를 XOR하면 된다.