Transcript Chapter 5

Chapter 5
Electronic mail
security
1
Outline
• Pretty good privacy
• S/MIME
• Recommended web sites
2
Pretty Good Privacy
• Philip R. Zimmerman is the creator of
PGP.
• PGP provides a confidentiality and
authentication service that can be used
for electronic mail and file storage
applications.
3
About Zimmerman
4
Why Is PGP Popular?
• It is availiable free on a variety of
platforms.
• Based on well known algorithms.
• Wide range of applicability
• Not developed or controlled by
governmental or standards organizations
5
Terms
•
•
•
•
•
•
•
•
•
•
•
KS : Session Key
KRa : Private key of A
KUa : Public key of A
ER : Encryption using RSA
DR : Decryption using RSA
EI : IDEA encryption
DI : IDEA decryption
H : hashing
|| : concatenation
Z : ZIP compression
R64 : radix 64 ASCII Format
6
PGP Structure
• Authentication & Digital Signature
• 송신자는 메시지 생성
• MD5를 이용하여 128비트 해쉬 코드 생성
• 해쉬 값을 RSA로 암호화하여 결과값에 포함
• 수신자는 송신자의 공개키를 이용해 해쉬 코드 복호화
• 수신자는 메시지에 대한 새로운 해쉬 코드와 복호화된
코드를 비교
• 만약 두 값이 같다면 메시지는 인증된 것이다.
7
PGP Structure
• Authentication & Digital Signature
– 인증과 전자 서명을 위해서는 RSA와
해쉬함수 MD5가 사용
ER [H(M)]
KRa
DR
KRa
ll
H
KUa
Z
Z-1
M
compare ?
ER
M
H
출처 A
목적지 B
8
PGP Structure
• Confidentiality
– 세션키를 통한 메시지 보호를 위해 다음과 같이 수행
• 송신자
– 메시지를 생성하고, 세션키로 사용될 128비트 난수
생성
– 메시지는 세션키로 IDEA를 이용하여 암호화
– 세션키는 수신자의 RSA 공개키를 이용해 암호화
되며, 메시지에 포함
• 수신자
– 자신의 RSA 개인키를 이용해 세션키를 알아냄
– 세션키를 이용하여 메시지를 복호화 한다.
9
PGP Structure
• Confidentiality
– 메세지의 기밀성을 위해서는 RSA와 IDEA가 함께
쓰인다
KUb
ERKUb[Ks]
KRb
Ks
ER
DR
M
Z
EI
ll
DI
M
Z-1
10
PGP Structure
• Confidentiality & Authentication
– 기밀성과 인증을 모두 보장하려면 인증을 위한 동작을 먼저
수행하고 그 결과에 기밀성을 위한 동작을 해주면 된다.
KUb
KRa
H
ER
ll
Z
Ks
ER
EI
ll
ERKUb[Ks]
KRb
ERKRa[H(M)]
KUa
DR
DR
DI
Z-1
Compare?
M
H
M
11
PGP Structure
• Compress
– 메시지 압축을 위해서는 ZIP 알고리즘을 사용
– 서명을 수행한 후에 압축을 취함으로써 암호화된 결과를 가지고
평문을 추측하는 행동을 더욱 어렵게 하고 전자 우편 전송과 화일
저장에 대해서 기억 공간을 절약한다는 이점이 있다.
• E-mail compatibility
– Radix-64 conversion을 통하여 3개의 8bit를 4개의 ASCII문자로
변환시킴으로서 기존의 전자 우편 시스템과의 호환성 문제를 해결
• Segmentation & Reassembly
– 전자 우편 프로그램은 대개 50,000byte이하의 메시지를 한번에 전송
– PGP에서는 50,000byte이상의 메시지를 쪼개어 전송, 또한 분할된
메시지를 자동으로 결합
12
About Radix-64
13
메시지 압축보다 서명을
먼저하는 이유(1)
•
받은 메시지를 나중에 검증 또는 이용할 때
차이가 발생함.
–
–
서명된 메시지를 압축시 : 압축을 푼 메시지와
서명만을 저장하면 이후에 검증 가능.
압축된 메시지를 서명시 : 재압축하여
검증하거나 압축되지 않은 메시지와 압축된
메시지를 모두 저장해 두어야 함
Ex) 받은 메시지를 다른 사람에게 포워딩할 경우.
14
메시지 압축보다 서명을
먼저하는 이유(2)
• 압축되지 않은 메시지 원본과 압축된 메시지에 대한
서명을 가진 경우.
– 검증을 위해 메시지 압축이 요구되지만 메시지를 다시
압축(algorithm is not deterministic)한 결과물과 서명을
생성했던 압축 메시지가 같다는 것을 보장 못함.
– 같은 압축 알고리즘이라도 압축시간과 압축률은 tradeoff관계에 있으므로 압축 결과물이 달라짐.
결국 모든 Host들이 같은 알고리즘과 같은 압축률을
사용하여야 하는 제한을 가지게 됨.
15
암호화와 키 연결 관계
• PGP에서 사용되는 암호화 키
– 세션키(IDEA 이용)
• 전송 메시지 암호화에 이용, 각 세션키는 한 번만 사용됨
– 공개키(RSA 이용)
• 세션키 암호화에 이용(송•수신자는 서로의 공개키 복사본
관리 필요)
– 개인키 (RSA 이용)
• 디지털 서명을 위한 메시지 암호화에 이용
– passphrase-based 키(IDEA 이용)
• 키 송신자가 저장하는 개인키를 암호화하는데 이용
16
PGP Message
• PGP메시지의 일반 요소
– 구분
• 세션키 부분
• 서명 부분
• 메시지 부분
– 서명 부분의 구성 요소
• 타임 스템프
• 메시지 다이제스트
• 메시지 다이제스트의 맨 앞 두 옥텟
• 송신자 공개키의 키 ID
17
PGP 메시지의 일반 형식
세션키
구성요소
수신자의 공개키 (KUb)의 키 ID
Session Key (Ks)
Time Stamp
송신자의 공개키 (KUa)의 키 ID
서명
메시지 다이제스트의
R64
선행 두 옥텟
Message Digest
ZIP
EIKs
File Name
메시지
Time Stamp
Data
18
Key Ring
– 모든 키는 사용자가 효과적으로 사용할 수 있도록 체계적인
방법으로 관리, 저장될 필요가 있다.
– 사용자가 소유하는 공개/개인키 쌍과 다른 사람의 공개키들을
저장하기 위한 자료 구조를 제공
– 개인키 링, 공개키 링
• 개인키 링
• 사용자 ID나 키 ID로서 색인화
• 사용자의 시스템에만 저장, IDEA를 이용하여 암호화
19
Key Ring(계속)
• 공개키 링
• 다른 사용자와 상호 운영하기 위해서는 다른 사용자의
공개키를 가지고 있어야 함
• 사용자 ID나 키 ID로서 색인화
• attack으로부터 공개키를 보호하는 일이 가장 어려운 문제
• 공개키를 보호하는 접근법
– 실제로 가져 옴
– 전화 통화로 확인
– 양쪽이 신뢰하는 개인으로부터
– 신뢰되는 인증기관으로부터
20
PGP Message Transaction(송신)
Passphrase
H
선택
ID
B
선택
ID
암호화된
개인키
A
키 ID
공개키 링
DI
Private key
KRa
개인키 링
RNG
Key ID
세션키
Ks
공개키
KUb
ER
ll
출력
Radix-64
M
H
ER
ll
Z
EI
암호화된 (서명 + 메시지)
next on the continued
RNG : random number generator
21
PGP Message Transaction(수신)
Passphrase
H
선택
암호화된
개인키
선택
DI
수신자의
키 ID
개인키
KRb
공개키 링 공개키
KUa
개인키 링
DR
암호화된
세션키
Radix-64
암호화된
(메세지
+
서명)
송신자의
키 ID
세션키
Ks
DI
DR
암호화된
다이제스트
Compare?
Z-1
서명
H
22
PGP 관련 파일 설명
• PGP 관련 화일
– pubring.pgp
• 자신의 공개키와 다른 사람의 공개키를 함께 저장하는 화일
• 이진 형태로 저장, 일반 명령으로 확인 불능
– secring.pgp
• 사용자 자신의 비밀키만을 저장
• passphrase를 IDEA의 키로 사용하여 암호화 해 놓는다.
– randseed.bin
• 공개/비밀키를 생성하는데 필요한 두 개의 random prime
number를 선택하는데 이용되는 seed 값과 IDEA의 생산에 쓰일
seed값을 보관
23
PGP 관련 내용 설명
• Passphrase
– 패스워드 개념
– 길이에 제한이 없으며, MD5 hash function을 거치면서
128bit의 hash code가 생성
– 128 bit IDEA의 키를 사용하여 message를 암호화하거나,
RSA에서 생성된 비밀키를 암호화하여 개인키 링
(secring.pgp)에 저장
• Fingerprint
– 160-bit SHA-1 Digest of the Key by using PGP, then
displaying it in Hexadecimal format
• Or 공개키를 MD5를 사용하여 128bit의 형태로 나타내는 것
– 각 키에 대해 고유한 값을 가진다
– 키의 신원을 확인할 수 있는 도구로 이용
24
Fingerprint
25
PGP install
• PGP를 구할 수 있는 곳
– http://www.pgpi.org/
• PGP Version
– PGP 2.3a
– PGP 2.6ui
– MIT PGP 2.6.2
– PGP 2.6.3i
– PGP 3.0
– 현재 최신 version으로 PGP 8.0
26
Revoking Public Keys
• The owner issues a key revocation
certificate.
• The same form as normal signature
certificate with a revote indicator.
• Corresponding private key is used to
sign the certificate that revoke the use
of this public key
27
S/MIME
• Secure/Multipurpose Internet Mail
Extension
• S/MIME will probably emerge as the
industry standard.
• PGP for personal e-mail security
28
Simple Mail Transfer Protocol (SMTP,
RFC 822)
• SMTP Limitations
– Can not transmit executable files, or other binary
files (jpeg image)
– Can not transmit“national language” characters
(non-ASCII) : SMTP is limited to 7-bit ASCII
– SMTP servers may reject mail messages over a
certain size
– SMTP gateways : ASCII to EBCDIC translation
problems
– Truncating or wrapping lines longer than a certain
length (ex, 76 characters)
29
Header fields in MIME
• MIME-Version: Must be “1.0” -> RFC 2045, RFC
2046
• Content-Type: Describing the data contained in the
body.
– More types being added by developers (application/word)
• Content-Transfer-Encoding: How message has
been encoded (radix-64)
• Content-ID: Unique identifying character string
– To identify MIME entities uniquely in multiple contexts
• Content Description: Needed when content is not
readable text (e.g.,mpeg)
30
MIME example
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MIME-Version: 1.0
From: Nathaniel Borenstein
Subject: A multipart example
Content-Type: multipart/mixed;
boundary=unique-boundary-1
This is the preamble area of a multipart message. Mail readers that understand multipart format
should ignore this preamble. If you are reading this text, you might want to consider changing to a
mail reader that understands how to properly display multipart messages.
--unique-boundary-1
Some text appears here... [Note that the preceding blank line means no header fields were given
and this is text, with charset US ASCII. It could have been done with explicit typing as in the next
part.]
--unique-boundary-1
Content-type: text/plain; charset=US-ASCII
This could have been part of the previous part, but illustrates explicit versus implicit typing of body
parts.
--unique-boundary-1
Content-Type: multipart/parallel; boundary=unique-boundary-2
--unique-boundary-2
Content-Type: audio/basic
Content-Transfer-Encoding: base64
... base64-encoded 8000 Hz single-channel u-law-format audio data goes here ...
--unique-boundary-2
Content-Type: image/gif
Content-Transfer-Encoding: Base64
... base64-encoded image data goes here ...
31
MIME example
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Date: Tue, 3 Sep 1996 09:25:52 -0700 (PDT)
From: Judith Grobe Sachs <[email protected]>
To: Judith Grobe Sachs <[email protected]>
Subject: A MIME Example
Message-ID: <.\[email protected]> X-X-Sender:
[email protected]
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="5494-19501-841=:9866"
--5494-19501-841=:9866
Content-Type: TEXT/PLAIN; charset=US-ASCII
This is the regular text body of a sample message with MIME. ... the rest of the plain text
body ...
--5494-19501-841=:9866
Content-Type: VIDEO/x-msvideo; name="MACAW.AVI"
Content-Transfer-Encoding: BASE64
Content-ID: <[email protected]>
Content-Description: This is a MS movie.
UklGRrC3AQBBVkkgTElTVNQHAABoZHJsYXZpaDgAAACFRQEAUccAAAAAAAAQ
32
S/MIME Functions
• Enveloped Data: Encrypted content and
encrypted session keys for recipients.
• Signed Data: Message Digest encrypted with
private key of “signer.”
• Clear-Signed Data: Signed but not encrypted.
• Signed and Enveloped Data: Various
orderings for encrypting and signing.
33
S/MIME example
•
•
•
•
Content-Type: application/pkcs7-mime; smime-type=signed-data;
name=smime.p7m
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7m
67GhIGfHfYT6ghyHhHUujpfyF4f8HHGTrfvhJhjH776tbB9HG4VQbnj777n8HHGT9HGVQp
fyF467GhIGfHfYT6rfvbnj756tbBghyHhHUujhJHHUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT
6jH7756tbB9H7n8HHGghyHh6YT64V0GhIGfHfQbnj75
• Content-Type: application/pkcs7-mime; smime-type=enveloped-data;
•
name=smime.p7m
• Content-Transfer-Encoding: base64
• Content-Disposition: attachment; filename=smime.p7m
fvbnj756tbBghyHhHUujhJhjH77n8HHGT9HG4VQpfyF467GhIGfHfY
T67n8HHGghyHhHUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756t
bB9Hf8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhH
UujpfyF40GhIGfHfQbnj756YT64V
34
S/MIME on outlook
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Configuring Your Mail Client
You may wish to make some small changes to your email client for a better S/MIME
experience.
Outlook XP/2003
Signing All Outbound Messages
Tools > Options…
Click the “Security” tab.
Check the “Add digital signature to outgoing messages” checkbox.
Also check the “Send clear text signed message when sending signed messages”.
Back-up your Certificates
Click the “Import/Export…” button.
Select the “Export your Digital ID to a file” radio button.
Click the “Select…” button.
Choose the Certificates you wish to export from the list, then click the “OK” button.
In the “Filename” field, type a filename for your exported certificate.
To protect your exported certificates, enter a password and confirm.
Click the “OK” button again.
You will need to enter the password for your certificate at this time and click “OK” (do not
check the “Remember password” checkbox – this will defeat the “High” level of security on
your certificate).
Click the “OK” button.
35
S/MIME on outlook
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Adding Buttons (Turn off Word as Editor)
Go to Tools > Options > Mail Format (Tab)
Uncheck “Use Word to edit email messages”
Click “OK”
Create a new email message…
Right-click on the toolbar and click “Customize”
Select the “Commands” tab, and select the “Standard” category of commands.
In the “Commands:” window, you will see two buttons near the bottom.
One is an envelope with a red seal, the other is an envelope with a blue lock.
Drag each of these into your toolbar (to a place you like – I put mine just before the “Options”
button.
Click “Close”.
You should now have two buttons on your toolbar.
Sending Signed Email by Default
Go to Tools > Options > Security (Tab)
Check “Add digital signature to outgoing messages”
Check “Send clear text signed message when sending signed messages”
(NOTE: If you do not send messages as cleartext signed, users without an S/MIME
supporting email client will be unable to read them – they will look like an encrypted email
message.)
Click “OK”
Outlook Express
When a user sends their new cert after their old cert expires, you need to open their contact,
go to “Digital ID’s” and set their new cert as default – otherwise the old cert will be used.
36
S/MIME 인증서 처리
- User Agent Role • S/MIME uses Public-Key Certificates - X.509 version
3 signed by Certification Authority
• Functions:
– Key Generation - Diffie-Hellman, DSS, and RSA key-pairs.
– Registration - Public keys must be registered with X.509
CA.
– Certificate Storage - Local (as in browser application) for
different services.
– Signed and Enveloped Data - Various orderings for
encrypting and signing.
37
S/MIME 인증서 처리 발급기관
(VeriSign)
• Digital ID 발급 기관 (Netscape/MS products)
–
–
–
–
–
–
–
–
–
소유자공개키
이름 and 별칭
Digital ID 만료일자
DigitalID 순서번호
DigitalID 발급 인증기관
DigitalID 발급 인증 기관의 전자서명
주소
전자메일주소
기본등록정보(국가, zip code, age, 성별)
38
S/MIME 인증서 처리 발급기관
(VeriSign)
• Verisign (www.verisign.com)
– Class-1: confirmed buyer’s email address by
emailing vital information (PIN and Digital ID)
– Class-2: Postal address is confirmed as well
– Class-3: An individual must prove his or her name
by providing notarized credentials or applying in
person (offline)
39
Algorithms Used
• Message Digesting: SHA-1 and MD5
• Digital Signatures: DSS
• Secret-Key Encryption: Triple-DES, RC2/40
(exportable)
• Public-Private Key Encryption: RSA with
key sizes of 512 and 1024 bits, and DiffieHellman (for session keys).
40