You are on page 1of 41

Chương 5.

1: Digital Certificates
Chứng thư điện tử
Nội dung

 Chữ ký số - Digital signatures


 Giấy tờ tuỳ thân
 Chứng thư số - Digital certificates
 Hệ thống chứng thực phân cấp
 Chuỗi chứng thực
 Xác thực từ xa
 Hạ tầng khoá công khai (PKI)
 Mã hoá ASN.1 của chứng thư số
Chữ ký số - Digital Signatures

 Chữ ký viết tay là một chức năng của người ký,


nó không phải thông điệp.
 Chữ ký viết tay có thể sao chép và giả mạo.
 Thực hiện số hoá chữ ký viết tay sẽ không có ích
lợi gì trong TMĐT.
 Chữ ký số phải có khả năng
 Tương đương như chữ ký “thực sự” và
 Bảo đảm rằng nó không bị sao chép hay giả mạo.
 Làm thế nào để chứng minh danh tính của mình
trên Internet?
Theo Luật Giao dịch điện tử
 Chữ ký điện tử là
 Dữ liệu dưới dạng điện tử (từ, chữ, số, ký

hiệu, âm thanh hoặc các hình thức khác)


 Gắn liền hoặc kết hợp một cách lô gíc với

thông điệp dữ liệu


 Có khả năng xác nhận người ký thông điệp dữ

liệu và xác nhận sự chấp thuận của người đó


đối với nội dung thông điệp dữ liệu được ký
Chữ ký số
 Một Chữ ký số là chức năng của cả người ký và
thông điệp dữ liệu.
 Chữ ký số có được bằng cách đem mã hoá bản
tóm tắt của thông điệp bằng khoá bí mật của
người ký. Thông điệp M

Thực hiện hàm băm (SHA-1)


Tạo ra bản tóm tắt (MESSAGE DIGEST)

HASH
Khoá bí mật Mã hoá bằng khoá bí mật
của MR. A

SIG Đây là Chữ ký số của


MR. A trên thông điệp M
Chứng thực bằng chữ ký số
Người nhận sẽ nhận Thông điệp + chữ ký số

SIG Thông điệp M

Thông điệp M

Giải mã chữ ký số bằng Sử dụng hàm SHA-1


khoá công khai của người ký Để băm thông điệp

HASH =? HASH

Nếu kết quả băm giống nhau, Thông điệp được xác thực.
Tại sao?
Vì nếu bất kỳ BIT nào của M hay SIG bị thay đổi, kết quả băm sẽ khác
Giấy tờ tùy thân
 Giấy tờ tuỳ thân là gì? (Chứng minh nhân dân, Passport, khai sinh,
bằng lái xe)
 Mảnh giấy

 Phát hành bởi bên thứ 3 được tin tưởng.

 Với thông tin xác minh danh tính của người sở hữu

 Giấy tờ tuỳ thân không có giá trị nếu không có dấu hiệu nhận
diện
 Nhận diện : giao thức để người cầm giấy tờ chứng minh mình là
người có tên trong giấy tờ này
 Hình

 Chữ ký

 Vân tay
Tin tưởng giấy tờ tuỳ thân
 Tại sao mọi người tin tưởng giấy tờ tuỳ thân?
 Phụ thuộc cơ quan ban hành
 Tôi có nhận ra giấy tờ này không?

 Tôi có biết cơ quan ban hành?

 Giấy tờ này có bị làm giả hay thay đổi?

 Dấu hiệu nhận diện nào có hiệu lực?


Minh họa
Chứng thư số - Digital Certificate
 Một giấy tờ tuỳ thân số gắn kết một cặp khoá (bí
mật, công khai) với một cá nhân hay tổ chức.
 Xác minh một chữ ký số chỉ chứng minh rằng
người ký có khoá bí mật phù hợp với khoá công
khai đã dùng giải mã chữ ký.
 Không chứng minh là cặp khoá thuộc về cá nhân
hay tổ chức đã công bố/khai báo.
 Chúng ta cần một tổ chức độc lập xác thực nhân
thân (theo cách thông thường) và phát hành
chứng thư số.
Nội dung của Chứng thư số
 Số Serial
 Tên chủ thể của chứng thư
 Khoá công khai
 Tên của tổ chức cấp chứng thư số (Cơ quan
chứng thực CA - Certificate Authority)
 Chữ ký số của CA cấp chứng thư số đó.
 Thông tin về thuật toán Hash (băm), thuật toán
khoá công khai sử dụng.
 Một số thông tin khác về chủ thể như số CMND,
số giấy phép ĐKKD,…
Generating a Digital Certificate
Version of Certificate Standard
Hashing
Certificate Serial Number
Algorithm
Signature Algorithm Identifier

Issuer
Message
Period of Validity
Digest
Subject
C=US ST=NY L=Albany O=OFT CN=John Doe

Subject’s Public Key


Algorithm Identifier + Key Value
Issuer’s
Signature of Issuer Private
Key
SOURCE: CARL SMIGIELSKI
Chứng thư máy trạm - Client
 Còn gọi là chứng thư cho cá
nhân hay cho trình duyệt.
 Signing certificate
 Bound to key-pair used for digital
signatures
 Encrypting certificate
 Bound to key-pair used for
encryption
 Extensive support found in
SSL/TLS (next lecture)

SOURCE: CARL SMIGIELSKI


Other Types of Certificates
 Root Certificates
 Self-signed by a Certification Authority
 CA Certificates
 For verifying signatures on issued certificates
 Server Certificates
 For use by SSL/TLS servers
 Software Signing Certificates
 For signing executable code

SOURCE: CARL SMIGIELSKI


Digital Certificate Verification
 Do I trust the CA? (Is it in my list of trust root certification
authorities?)
 Is the certificate genuine?
 Look up the CA’s public key; use it to decrypt the signature
 Compute the certificate’s hash; compare with decrypted sig
 Is the holder genuine? This requires a challenge
 If the holder is genuine, he must know the private key
corresponding to the pubic key in the certificate
 Having the certificate is not enough. (They are exchanged
over the Internet all the time)
 Send him a nonce (random 128-bit number)
Challenge by Nonce

 If you’re really Shamos, you must know his private


key
 So please encrypt this nonce with his private key:
“A87B1003 9F60EA46 71A837BC 1E07B371”
 When the answer comes back, decrypt it using the
public key in the certificate
 If the result matches, the remote user knew the
correct private key
 Never use the same nonce twice
ISO X.500 Directory Standard
PURPOSE: MAKE SURE NO TWO ENTITIES OR PEOPLE HAVE THE SAME NAME

STANDARD FOR HIERARCHICAL RDN: RELATIVE DISTINGUISHED NAME


DIRECTORIES
C: ISO COUNTRY CODE

O: ORGANIZATION

CN: COMMON NAME

EACH RDN MAY HAVE ATTRIBUTES


SOURCE: XCERT.COM
Certification Hierarchy

 What happens if you don’t recognize the CA in a


certificate or it is not a trusted CA?
 Suppose CA has a certificate issued by trusted
CA2?
 You may choose to trust CA if you can verify that
its certificate is genuine
CA2
CA’S CERTIFICATE
ISSUED BY CA2
CA
HOLDER’S CERTIFICATE
ISSUED BY CA
CERTIFICATE
HOLDER
Certificate Authority Hierarchy

Root CA issues its own certificate!

RCA
RCA : Root Certificate Authority
BCA : Brand Certificate Authority
BCA GCA : Geo-political Certificate Authority
CCA : Cardholder Certificate Authority
MCA : Merchant Certificate Authority
PCA : Payment Gateway
GCA Certificate Authority

CERTIFICATE ISSUANCE

CCA MCA PCA


Certification Path
SEQUENCE OF CERTIFICATES LEADING TO A TRUST POINT, USUALLY A ROOT

Root CA
Root CA Root CA's Private Key
Self Signed Certificate Info
Root Signature

Subordinate CA
Certificate Info Root CA's Private Key
Sub CA
Root Signature

Subordinate CA's Private Key


Alice
Certificate Info
SubCA's Signature

Text
Document Alice's Private Key

Alice's Signature

SOURCE: MARK SILVERMAN


Building a Certification Path

HHS Root CA
Bob gets cert from Alice

1. Alice's cert signed by CDRH


NIH FDA
2. CDRH's cert signed by FDA
3. FDA's cert signed by HHS
CIT CDRH
HHS is Bob's trust point,
therefore Bob trust's Alice's cert

Bob Alice

SOURCE: MARK SILVERMAN


Certification Paths
 Alice has a certificate issued by authority D
 To verify Alice’s certificate, Bob needs the public key
of authority D (to decrypt D’s signature on the
certificate)
 How does Bob get it so he is sure it is really the public
key of D? This is another verification problem.
 Solution: Alice sends Bob a certification path, a
sequence of certificates leading from her authority D
to Bob. The public key of D is in D’s certificate
 (D’s certificate is not enough for verification since Bob
may not know D’s certification authority G)
One-Way Remote Authentication
 How can Alice send a message to Bob so
Bob knows that
 the message is from the real Alice
 the message was intended for Bob
 no one has altered or replayed the message
 Message must include
 Alice’s signature & certification path
 Bob's identity
 timestamp & nonce
One-Way Authentication
Alice Insecure Channel Bob
IDA RA RS RS random value
Challenge (Nonce)

IDA INCLUDES A Eve


CERTIFICATE AND Hash
CERTIFICATION PATH IDA RA RS

Encryption with
Private Key
Hash Hash

IDA RA Sig Response


Decryption with
Public Key

Sig
SOURCE: ANDREAS STEFFEN, ZHW
Public Key Infrastructure (PKI)
 Digital certificates alone are not enough to
establish security
 Need control over certificate issuance and management
 Certification authorities issue certificates
 Who verifies the identify of certification authorities?
 Naming of entities
 Certification Practice Statement
 Certificate Revocation List
 The metafunctions of certificate issuance form the
Public Key Infrastructure
Certification Practice Statement
 Satement by a CA of the policies and procedures
it uses to issue certificates
 CA private keys are on hardware cryptomodules
 View Verisign Certification Practice Statement
 INFN (Istituto Nazionale di Fisica Nucleare) CPS

IBM S/390 SECURE LITRONIC 440


RAINBOW LUNA CA3 CIPHERACCELERATOR
TRUSTED ROOT KEY SYSTEM CRYPTOGRAPHIC MODULE
Certificate Revocation List
 Online list of revoked certificates
 View Verisign CRL
 Verisign CRL usage agreement
Functions of a Public Key
Infrastructure (PKI)
 Generate public/private key pairs
 Identify and authenticate key subscribers
 Bind public keys to subscriber by digital certificate
 Issue, maintain, administer, revoke, suspend,
reinstate, and renew digital certificates
 Create and manage a public key repository
Format of Digital Certificates
 Certificates contain many fields, must be read by
computers all over the world
 X.509 certificates are in a standard format described
in the language ASN.1
 ASN.1 is a method of encoding data so that the
format can be decoded from the data itself
 ASN.1 is not a programming language
 It describes only data structures. No code, no logic.
 Can be used as input to a compiler to produce code
X.509 Certificate
Abstract Syntax Notation
 ASN.1 is widely used – e.g. all digital certificates
 ASN.1 has primitive types:
BOOLEAN, INTEGER, REAL, ENUMERATED, BIT STRING,
IA5STRING, . . .
 ASN.1 has
 SET (unordered)
 SEQUENCE (fixed order) of primitive types
 CHOICE for selecting alternative types (integer or real)
 Can define new types:
Month ::= INTEGER (1..12)
Day ::= INTEGER (1..31)
Daily-stock-volume ::= SEQUENCE SIZE (31) OF INTEGER
Basic Encoding Rules (BER)
 Define how fields described in ASN.1 should be encoded
 Units of BER are data elements
 A data element is a triple TLV:
{ type, length, value }
 Some type codes:
BOOLEAN 01
IA5STRING 16 (8-BIT ASCII)
INTEGER 02
SEQUENCE 10
SET 31

 The string “Customer” would be encoded as


16 08 43 75 73 74 6F 6D 65 72
IA5STRING LENGTH HEX HEX HEX
8 “C” “u” “r”
Basic Encoding Rules
 Content field may be primitive (value) or
structured (content has subcomponents)
Basic Encoding Rules
BBCard ::= SEQUENCE {
name IA5String (SIZE (1..60)),
team IA5String (SIZE (1..60)),
age INTEGER (1..100),
position IA5String (SIZE (1..60)),
handedness ENUMERATED {left-handed(0),
right-handed(1), ambidextrous(2)},
batting-average REAL }

“Casey”, “Mudville Nine”, 32, “left field”, ambidextrous,


0.250 (47 bytes of text)
C a s e y M u d v i l l e
302D1605 43617365 79160D4D 75647669 6C6C6520 4E696E65
02012016 0A6C6566 74206669 656C640A 01020903 80FE01
(47 bytes in BER)
ASN.1 Definition of X.509 Certificate
“TO BE SIGNED” CERTIFICATE
Certificate ::= SEQUENCE { = INTERMEDIATE (NON-ROOT)
tbsCertificate TBSCertificate, CERTIFICATE
signatureAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING }
TBSCertificate ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name, validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,--
If present, version shall be v2 or v3
subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,--
If present, version shall be v2 or v3
extensions [3] EXPLICIT Extensions OPTIONAL --
If present, version shall be v3 }
ASN.1 Definition of X.509 Certificate
Version ::= INTEGER { v1(0), v2(1), v3(2) }
CertificateSerialNumber ::= INTEGER
AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL}
Name ::= CHOICE { RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE {
type AttributeType,
value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
Validity ::= SEQUENCE {
notBefore Time, notAfter Time }
Time ::= CHOICE { utcTime UTCTime, generalTime GeneralizedTime }
UniqueIdentifier ::= BIT STRING
SubjectPublicKeyInfo ::= SEQUENCE {
algorithm AlgorithmIdentifier,
subjectPublicKey BIT STRING }
Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
Extension ::= SEQUENCE {
extnID OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
extnValue OCTET STRING }
Using ASN.1/BER

SOURCE LANGUAGE APPLICATION


ASN.1 ASN.1 (JAVA, C)
DEFINITIONS COMPILER CODE
DATA STRUCTURES

ENCODER/ APPLICATION PROGRAM


DECODER

(JAVA, C)
COMPILER

APPLICATION PROGRAM APPLICATION


NOW READS AND WRITES PROGRAM
DATA ACCORDING TO BER
ASN.1 Applications
 Telephone billing information
 Transferred Account Procedure (TAP3)
 UMTS (3G phones)
 X9 financial services (checks, electronic funds transfer)
 Air-to-ground aircraft information
 Electric and gas utilities
 Automobile diagnostic monitoring systems
 Radio Frequency Identification (RFID)
 Biometric IDs (Proposed ANSI Standard X9.84)
 Common Biometric Exchange File Format CBEFF
 Smart cards (ISO 7816-4)
 MORE
Major Ideas
 Digital signature = hash of message encrypted with signer’s
private key. Computationally unforgeable
 Digital certificate = digital identity document issued by a
trusted third party. Associates a public key with a real person
 A digital signatures without a certificate does not prove
identity
 The holder of a certificate must be challenged to prove he
knows the correct private key
 Certificate authorities form trust hierarchies, with certificate
paths from sender to recipient, allowing verification of the
trust relationship
Major Ideas
 MANY eCommerce applications do not require verification
of identity, but only verification of authorization
 Digital certificates are useful when identity must be proven
or when interacting with multiple parties not known in
advance
 A long-term relationship between two parties does not
require a digital certificate; a password is often (not always)
sufficient
 ASN1. is a “hidden” method of specifying data formats, but
used is many applications, including digital certificates

You might also like