[TIL] HTTP : The Definitive Guide "p309 ~ p312"

시윤·2025년 4월 10일

[TIL] Two Pages Per Day

목록 보기
125/146
post-thumbnail

Chapter 14. Secure HTTP

(해석 또는 이해가 잘못된 부분이 있다면 댓글로 편하게 알려주세요.)


✏️ 원문 번역


Digital Cryptography

Before we talk in detail about HTTPS, we need to provide a little background about the cryptographic encoding techniques used by SSL and HTTPS. In the next few sections, we’ll give a speedy primer of the essentials of digital cryptography. If you already are familiar with the technology and terminology of digital cryptography, feel free to jump ahead to “HTTPS: The Details.”

  • HTTPS에 대해 자세히 알아보기 전에 SSL과 HTTP에서 사용되는 암호학 인코딩 기술에 관한 배경지식이 필요합니다.

  • 이어지는 섹션에서 디지털 암호학의 필수 요소를 간단히 설명합니다.

  • 디지털 암호학 기술 및 용어에 이미 친숙하다면 "HTTPS: The Details" 섹션으로 건너뛰어도 좋습니다.

In this digital cryptography primer, we’ll talk about:

Ciphers
Algorithms for encoding text to make it unreadable to voyeurs

Keys
Numeric parameters that change the behavior of ciphers

Symmetric-key cryptosystems
Algorithms that use the same key for encoding and decoding

Asymmetric-key cryptosystems
Algorithms that use different keys for encoding and decoding

Public-key cryptography
A system making it easy for millions of computers to send secret messages

Digital signatures
Checksums that verify that a message has not been forged or tampered with

Digital certificates
Identifying information, verified and signed by a trusted organization

  • 디지털 암호학 기초 섹션에서는 다음의 요소들을 다룰 것입니다.

  • Ciphers : 감청 중인 공격자가 읽을 수 없도록 텍스트를 인코딩하는 알고리즘

  • Keys : Cipher의 동작을 좌우하는 숫자 매개변수

  • Symmetric-key Cryptosystems : 인코딩과 디코딩에 동일한 키를 사용하는 알고리즘

  • Asymmetric-key Cryptosystems : 인코딩과 디코딩에 서로 다른 키를 사용하는 알고리즘

  • Public-key Cryptography : 수백만 대의 컴퓨터가 비밀 메시지를 쉽게 전송할 수 있게 하는 시스템

  • Digital Signatures : 메시지가 위조 혹은 변조되지 않았음을 증명하기 위한 체크섬

  • Digital Certificates : 신뢰할 수 있는 기관이 확인 및 서명한 식별 정보

The Art and Science of Secret Coding

Cryptography is the art and science of encoding and decoding messages. People have used cryptographic methods to send secret messages for thousands of years. However, cryptography can do more than just encrypt messages to prevent reading by nosy folks; it also can be used to prevent tampering with messages. Cryptography even can be used to prove that you indeed authored a message or transaction, just like your handwritten signature on a check or an embossed wax seal on an envelope.

  • 암호학은 메시지 인코딩과 디코딩에 관한 경험이자 기술입니다.

  • 사람들은 수천 년간 비밀 메시지를 전송하기 위한 암호학 기술을 사용해 왔습ㄴ디ㅏ.

  • 하지만 암호학은 단순히 메시지를 암호화하여 감청자가 읽지 못하도록 하는 것을 넘어 메시지 변조를 방지하는 데에도 사용할 수 있습니다.

  • 암호학을 활용하면 수표에 자필 서명을 하거나 봉투에 왁스 도장을 찍는 것처럼 메시지나 트랜잭션을 전송한 당사자가 정말 본인인지 인증할 수 있는 수단을 제공하기도 합니다.


Cipher

Cryptography is based on secret codes called ciphers. A cipher is a coding scheme—a particular way to encode a message and an accompanying way to decode the secret later. The original message, before it is encoded, often is called plaintext or cleartext. The coded message, after the cipher is applied, often is called ciphertext. Figure 14-3 shows a simple example.

  • 암호학은 Cipher라고 하는 비밀 코드에 기반합니다.

  • Cipher는 특정한 방식을 사용해 메시지를 인코딩하기 위한 기법과 추후 생성된 메시지를 디코딩하기 위한 기법을 모두 포함하는 코드 생성 기술입니다.

  • 인코딩 되기 전의 원본 메시지를 plaintext 혹은 cleartext라고 부릅니다.

  • 반대로 Cipher가 적용된 후의 암호화된 메시지는 ciphertext입니다.

  • Figure 14-3에서 간단한 예시를 보여주고 있습니다.

Ciphers have been used to generate secret messages for thousands of years. Legend has it that Julius Caesar used a three-character rotation cipher, where each character in the message is replaced with a character three alphabetic positions forward. In our modern alphabet, “A” would be replaced by “D,” “B” would be replaced by “E,” and so on.

  • Cipher는 수천 년간 비밀 메시지를 생성하기 위해 사용되어 왔습니다.

  • 전설에 따르면 Julius Caesar(율리우스 카이사르)는 three-character rotation을 활용한 Cipher를 사용했다고 합니다.

  • 메시지의 각 문자를 세 칸 뒤의 알파벳으로 치환하는 방식입니다.

  • 현대 알파벳 기준으로 "A"는 "D"로 치환되며 "B"는 "E"로 치환됩니다.

For example, in Figure 14-4, the message “meet me at the pier at midnight” encodes into the ciphertext “phhw ph dw wkh slhu dw plgqljkw” using the rot3 (rotate by 3 characters) cipher.* The ciphertext can be decrypted back to the original plaintext message by applying the inverse coding, rotating –3 characters in the alphabet.

  • Figure 14-4와 같이 "meet me at the pier at midnight"이라는 메시지는 rot3을 사용하여 "phhw ph dw wkh slhu dw plgqljkw"라는 ciphertext로 인코딩할 수 있습니다.

  • ciphertext는 알파벳의 위치를 3칸 뒤로 옮기는 해독 기법을 적용하여 원본 plaintext 메시지로 복호화 할 수 있습니다.


Cipher Machines

Ciphers began as relatively simple algorithms, because human beings needed to do the encoding and decoding themselves. Because the ciphers were simple, people could work the codes using pencil and paper and code books. However, it also was possible for clever people to “crack” the codes fairly easily.

  • Cipher는 인코딩과 디코딩의 필요성을 체감하면서부터 비교적 단순한 알고리즘의 형태로 시작되었습니다.

  • Cipher가 단순했기 때문에 사람들은 종이와 연필, 코드북만 있으면 해당 암호를 풀 수 있었습니다.

  • 영리한 사람이라면 암호를 너무나도 쉽게 해독하는 것이 가능했습니다.

As technology advanced, people started making machines that could quickly and accurately encode and decode messages using much more complicated ciphers. Instead of just doing simple rotations, these cipher machines could substitute characters, transpose the order of characters, and slice and dice messages to make codes much harder to crack.

  • 기술이 발전함에 따라 사람들은 훨씬 더 정교해진 Cipher가 적용된 메시지를 신속하고 정확하게 인코딩, 디코딩 할 수 있는 장치를 개발하기 시작했습니다.

  • 이러한 Cipher 장치는 단순한 로테이션을 수행하는 대신 문자를 대체하고, 순서를 바꾸고, 메시지를 분할하거나 재구성하여 암호를 훨씬 더 해독하기 어렵게 만들 수 있습니다.


Keyed Ciphers

Because code algorithms and machines could fall into enemy hands, most machines had dials that could be set to a large number of different values that changed how the cipher worked. Even if the machine was stolen, without the right dial settings (key values) the decoder wouldn’t work.

  • 대부분의 장치는 Cipher의 동작 방식을 바꾸기 위해 다양한 값을 설정할 수 있는 다이얼을 제공하고 있습니다.

  • 암호 알고리즘과 장치가 적의 손에 들어갈 수도 있기 때문입니다.

  • 장치를 도둑맞더라도 올바른 다이얼(key values) 설정 없이는 디코더가 제대로 동작할 수 없습니다.

These cipher parameters were called keys. You needed to enter the right key into the cipher machine to get the decoding process to work correctly. Cipher keys make a single cipher machine act like a set of many virtual cipher machines, each of which behaves differently because they have different key values.

  • 이러한 Cipher 파라미터를 Key라고 합니다.

  • Cipher 장치에 올바른 Key를 입력해야만 디코딩 절차가 올바르게 이루어질 수 있습니다.

  • Cipher Key는 하나의 Cipher 장치가 여러 대의 가상 Cipher 장치처럼 암호화를 수행할 수 있게 합니다.

  • 서로 다른 Key Value를 가진 Cipher 장치는 완전히 다르게 동작하기 때문입니다.

Figure 14-5 illustrates an example of keyed ciphers. The cipher algorithm is the trivial “rotate-by-N” cipher. The value of N is controlled by the key. The same input message, “meet me at the pier at midnight,” passed through the same encoding machine, generates different outputs depending on the value of the key. Today, virtually all cipher algorithms use keys.

  • Figure 14-5에서 Keyed Cipher의 예시를 나타내고 있습니다.

  • Cipher 알고리즘으로는 단순한 "rotate-by-N"을 사용하고 있습니다.

  • N의 값은 Key 값에 의해 제어됩니다.

  • 동일한 입력 메시지 "meet me at the pier at midnight"을 동일한 인코딩 장치에 입력하더라도 Key의 값에 따라 다른 결과가 생성됩니다.

  • 오늘날 가상의 모든 Cipher 알고리즘은 키를 사용하고 있습니다.


Digital Ciphers

With the advent of digital computation, two major advances occurred:

• Complicated encoding and decoding algorithms became possible, freed from the speed and function limitations of mechanical machinery.

• It became possible to support very large keys, so that a single cipher algorithm could yield trillions of virtual cipher algorithms, each differing by the value of the key. The longer the key, the more combinations of encodings are possible, and the harder it is to crack the code by randomly guessing keys.

  • 디지털 연산이 출현함에 따라 두 가지 주요한 발전이 있었습니다.

  • 기술적인 속도와 기능 제한에서 벗어나 복잡한 인코딩과 디코딩 알고리즘을 사용할 수 있게 되었습니다.

  • 지원할 수 있는 Key의 크기가 거대해지면서 서로 다른 Key 값에 따라 하나의 Cipher 알고리즘이 수조 개에 달하는 가상 Cipher 알고리즘을 생성할 수 있게 되었습니다. Key의 길이가 길수록 더 많은 인코딩 조합을 생성할 수 있습니다. 또한 무작위로 Key를 유추하여 암호를 해독하는 것이 어려워졌습니다.

Unlike physical metal keys or dial settings in mechanical devices, digital keys are just numbers. These digital key values are inputs to the encoding and decoding algorithms. The coding algorithms are functions that take a chunk of data and encode/decode it based on the algorithm and the value of the key.

  • 기계 장치의 물리적인 열쇠나 다이얼과는 달리 디지털 키는 숫자로만 이루어져 있습니다.

  • 디지털 키 값은 인코딩 및 디코딩 알고리즘의 입력으로 사용됩니다.

  • 암호 알고리즘은 알고리즘과 키 값을 바탕으로 입력받은 데이터 청크를 인코딩하고 디코딩하는 함수입니다.

Given a plaintext message called P, an encoding function called E, and a digital encoding key called e, you can generate a coded ciphertext message C (Figure 14-6). You can decode the ciphertext C back into the original plaintext P by using the decoder function D and the decoding key d. Of course, the decoding and encoding functions are inverses of each other; the decoding of the encoding of P gives back the original message P.

  • P라는 plaintext 메시지와 인코딩 함수 E, 디지털 인코딩 키 e가 주어졌을 때, 암호화된 Ciphertext 메시지 C를 생성합니다. (Figure 14-6)

  • ciphertext C는 디코딩 함수 D와 디코딩 키 d를 사용하여 plaintext P로 해독할 수 있습니다.

  • 당연히 디코딩 및 인코딩 함수는 서로 역함수 관계에 있습니다.

  • P를 인코딩한 값의 디코딩 결과는 원본 메시지 P와 동일합니다.


✏️ 요약


Terminologies of Digital Cryptography

  • Ciphers : 감청 중인 공격자가 읽을 수 없도록 텍스트를 인코딩하는 알고리즘
  • Keys : Cipher의 동작을 결정하는 매개변수
  • Symmetric-key Cyprosystems : 인코딩과 디코딩에 동일한 키를 사용하는 알고리즘
  • Asymmetric-key Cryptosystems : 인코딩과 디코딩에 서로 다른 키를 사용하는 알고리즘
  • Public-key Cryptography : 수백만 대의 컴퓨터가 비밀 메시지를 쉽게 전송할 수 있게 하는 시스템
  • Digital Signatures : 메시지가 위변조되지 않았음을 증명하기 위한 checksum
  • Digital Certificates : 신뢰할 수 있는 기관이 인증한 식별 정보

Digital Ciphers

: Cipher 알고리즘에 Key와 데이터 청크를 입력하여 암호화된 데이터를 반환하는 함수

  • C : Ciphertext
  • E : Cipher
  • P : Plaintext
  • e : Key
  • Encryption : C = E(P, e)
  • Decryption : P = D(C, d)
  • E와 D는 역함수 관계 : P = D(E(P,e),d)

✏️ 감상


네트워크 보안 공부하다 왔더니...

너무나 친숙한 단어들의 대잔치... 해석이 이렇게 쉬울 수가 없다. TIL 작성하기 전에 대충 90페이지 남짓하는 네트워크 보안 ppt를 정리하다 왔다. 정리한 내용이 그대로 HTTP 책에도 적혀 있어서 편했다. 저자가 암호학 용어에 친숙하다면 다음 섹션으로 넘어가도 된다고 적어놓긴 했지만, 목표가 정독이기 때문에 오늘 정리한 내용을 다시 복습한다는 느낌으로 한 번 더 읽었다..!!

암호학은 알면 알수록 재미있는 분야다. 비슷한 내용 한 번 더 읽었는데도 딱히 지루하진 않았다. 특히 해시함수 같은 것은 단방향 암호화 함수라는 데도 의의가 있지만 데이터 구조화에 활용하기도 좋아서 알면 도움이 많이 된다. 결국 해시함수도 cipher의 일종이고,, 암튼 재미있고,, 더 말하면 변태 같으니까 그만하겠다. 요즘 해시함수를 다룰 일이 조금 많다 보니 뇌가 조금 돌아버린 것 같다.

아마도 앞으로 며칠간은 계속 아는 내용이 반복될 것 같은데 복습한다 생각하고 꾸준히 읽어봐야겠다.

profile
틈틈이 두 페이지씩 원서 읽기

0개의 댓글