[컴퓨터네트워크] 기말고사 정리본 (2)
protect from eavesdropping
Encryption, Decryption with key
public key cryptography
protect from the imposters to alter the message
Authentication
Digital signature
plaintext - ciphertext (encrypt, decrypt)
여기부터 protect from eavesdropping
encryption은 amount of information이 바뀌지 않는다. 그리고 그냥 많은 수의 수학 연산을 수행하게 된다.
좋은 encryption algorithm : small change in the message or key should lead to big change in the encrypted message -> 'hard to guess'
symmetric key encryption : A and B uses the same key to encrypt and decrypt message (DES, 3 DES, AES)
AES (advanced encryption standard) -> fast, secure
encrypt key, decrypt key가 둘 다 private여야 한다.
(encrypt key와 decrypt key가 서로 같다.)
public key encryption : A and B uses different key to encrypt and decrypt message
B가 먼저 오직 encrypt만 가능한 public key를 모두에게 나누어주고, A는 그 public key를 이용하여 encrypt 한 뒤 B에게 전송 후 B는 private key를 이용하여 decrypt 한다.
encrypt와 decrypt가 one-way operation이다. (encrypt 한 key로 decrypt를 할 수 없다.)
K = p * q 일 때 K만 public이 알고 p&q는 private만 알고 있다. 만약 K를 통해 p와 q를 유추한다면 crypto system을 파괴.
RSA algorithm (large key - 1024 bit.)
먼저 symmetric key를 public key로 교환하고 symmetric key로 data를 encrypt 및 decrypt 한다.
여기부터 protect from the imposters to alter the message
authentication : data integrity (intended author인 Y가 정말 전송한 것인지 확인하는 방법은?)
original message에 signature를 붙인다. = MAC (Message Authentication Code)
MAC의 특성
(1) must uniquely represent the writer (hard to replicate by others)
(2) must be concise (length should not depend on the message) -> short 하게 만들어라.
MAC의 생성 : key, hashing algorithm
hashing algorithm을 key를 통해 접근하여 전체 메시지와 서명을 처리하여 MAC를 만들고, MAC과 원래 메시지를 같이 보낸다. 그리고 수신자가 원래 메세지를 다시 key를 이용하여 hashing algorithm을 적용한 후 수신된 MAC과 비교하여 일치하는지 확인한다. (같으면 진짜 발신자가 보낸 것임이 확인된다.)
message digest = cryptographic hashing function : mapping of arbitrary length message to a fixed-length code (loss of information, many different M can result in the same digest)
ex) MD5, SHA-1
좋은 MD : summary of a long message, small change in the original message, very different MD, hard to find two M that yield the same digest, uniformly maps input messages to output digest
물론, hashing algorithm은 key 없이도 사용할 수 있다.
Digital signature : use public key encryption. 단, encrypt가 private고 decrypt가 public인 게 기존과 차이점.
Message를 key 없이 hash algorithm을 적용하여 MAC을 생성한 뒤 MAC을 private key로 encrypt 한다. 그리고 encrypted MAC을 원래 message와 함께 전송한 후 수신자가 encrypt MAC을 decrypt 한 뒤 원래 message에 hashing algorithm을 적용하여 MAC과 비교한다. 계산된 MAC과 수신된 MAC이 같으면 message는 authenticated 된 것이다.
encrypted MAC이 발신자의 digital signature가 된다.
비트코인 : Cryptocurrency
name = public key (anonymity)
signature = private key