Está en la página 1de 12

Thanh Bnh

Tm tt lun vn thc s

H mt RSA v ng dng lc ch
k s trong xc thc thng tin : Lun
vn ThS. Cng ngh thng tin : 60 48
10 / Thanh Bnh ; Nghd. : PGS TS
on Vn Ban
Lun vn vi ti H mt RSA v ng dng lc ch k s
trong xc thc thng tin nghin cu v ng dng h mt m RSA trong
m ha d liu.
Ni dung c chia thnh cc chng nh sau:
Chng I: Tng quan v cc h mt m
Gii thiu m hnh mt s h mt m ang c ng dng nh h
m dch vng, m thay th, hon v, h mt m RSA, v.v...
Chng II: H mt m kho cng khai RSA
Nghin cu cc vn lin quan n h mt m kho cng khai
RSA; phng php lp m v gii m; cc c im v an ton ca
h mt; vn qun l kho, phn phi kho.
Chng III: Lc ch k s RSA
Gii thiu ch k s RSA, cc ng dng ca ch k s trong vic
xc thc d liu; lc ch k s; v.v...
Chng IV: Chng trnh m ho d liu
ng dng c s l thuyt nghin cu xy dng mt chng
trnh m ho ng dng cc k thut m kho b mt, m kho cng khai
v lc ch k s.

Thanh Bnh

Tm tt lun vn thc s

CHG 1 TG QUA V CC H MT M


1.1
H mt m c in
1.1.1 H thng truyn tin mt
Nhim v ca m mt l to ra kh nng lin lc trn knh cng
cng (cng khai) gia hai ngi s dng sao cho ngi thm m gia,
gi thit thu y thng tin trn knh, m khng th hiu c ni
dung bn r c truyn i. Thng tin ngi gi c cu trc tu ;
ngi gi s m ho bn tin r bng mt kho c xc nh trc v
gi bn m ti ngi nhn qua knh cng cng. Ngi nhn nh c
kho mt kD nn d dng c th gii m nhn c bn r.
Bn r
Ngun tin

B m ho

Knh truyn

Bn r
B gii m

Bn m
(Ngi gi)

KE

KD

Nhn tin
(Ngi nhn)

Thm m
(Ngi thm m)
Knh an ton
(truyn kho)
Ngun kho

H1.1: S khi h thng truyn tin mt

nh ngha 1.1: Mt h mt l mt b gm 5 tham s (R, M, K, E,


D) tho mn cc iu kin sau:
1) R l tp hu hn cc bn r c th
2) M l tp hu hn cc bn m c th
3) K (khng gian kho) l tp hu hn cc kho c th.
4) i vi mi k K c mt quy tc gii m ek: P C v mt
quy tc gii m tng ng dk D. Mi ek: R M v dk: M
R l nhng hm m: dk(ek(x)) = x vi mi bn r x R
1.1.2 Mt s h mt m kinh in
a) M dch vng
H mt c xy dng da trn s hc modulo. K hiu m l s ch
ci ca b ch xy dng bn r R.
Theo nh ngha 1.1, cho R = M = K = Zn vi 0 k (m - 1) v x, y
Zm; Zm l khng gian ch ci, ta nh ngha:

Thanh Bnh

23

Tm tt lun vn thc s

KT LU
Ni dung ca lun vn nghin cu cc vn l thuyt h mt m
kho cng khai RSA. K thut m kho cng khai RSA c ng dng
trong vic phn phi kho cng khai v s dng m ho v phn phi
kho b mt. Ngy nay, vic phn phi kho cng khai s dng chng
ch kho cng khai l phng n c dng ph bin. Lun vn cng tp
chung nghin cu lc ch k s RSA v cc ng dng ca n. Mt
trong nhng ng dng quan trng ca ch k s l vn xc thc
thng tin/d liu.
Trn c s cc vn l thuyt, tc gi xy dng mt chng trnh
m ho d liu m bo cc yu cu bo mt thng tin trong qu trnh
truyn tin. Thng tin c m ho pha ngi gi v c gii m
pha ngi nhn, ng thi c c ch ngi nhn kim tra tnh xc
thc ca thng tin nhn c. C ch phn phi kho cng khai c
thc hin bng vic trao i cc chng ch kho cng khai. Vic m ho
d liu c thc hin bng thut ton m ho kho i xng AES
m bo yu t tc m ho; thut ton m kho cng khai RSA c
s dng trong vic to/kim tra ch k s v trong vic phn phi kho
phin b mt ca thut ton m kho i xng AES.
Trong khun kh ca lun vn, chng trnh mi ch c xy dng
nh mt ng dng c lp v ch lm vic vi chng ch s chuNn X.509
c nh dng file PEM. c th trin khai chng trnh vo thc tin,
cn u t thm pht trin cc tnh nng nhm tng cng tnh tin
li ca ng dng, chng hn: cho php lm vic vi nhiu kiu nh
dng file chng ch s; cho php chuyn i qua li gia cc kiu nh
dng. N goi ra, c th pht trin thm mt la chn kiu chng trnh l
cho php ci t nh mt ng dng thm vo (add-in), tch hp tnh
nng m ho v xc thc thng tin/d liu ngay t bn trong mt ng
dng c th (chng hn, ng dng th in t Microsoft Outlook, v.v...).
Qua nhng hot ng v mt m trn thc tin cng vi nhng
nghin cu v kt qu ca lun vn c th khng nh mt m ni chung
v mt m RSA ni ring ng vai tr rt quan trng trong mi lnh vc
x hi. Vic nghin cu l thuyt mt m RSA v ng dng trin khai
k thut m ho ny cho ph hp vi nhng bi ton c th trong hot
ng thc tin l mt vn hon ton c th thc hin.

Thanh Bnh

22

Tm tt lun vn thc s

M HO

HASH value

SHA-1

RSA

GII M

Digital
Signature

Kho mt
m ho

Private Key
A

RSA

Private Key
B
D liu
m ho

D liu/
vn bn

AES

Kho mt
Digital
Signature

AES

D liu
m ho

Kho mt
D liu/
vn bn

CERT A

SHA-1

HASH value

Thanh Bnh

ek(x) = (x + k) mod m v dk(x) = (y - k) mod m


Cc h m mt hin i v thc cht l s ci tin ca m dch vng.
i vi m ho mt vn bn ting Anh thng thng l s thit lp
tng ng gia cc ch ci vi cc s theo modulo 26.
Tnh bo mt ca h m dch vng ni l khng cao, thm m c th
dng phng php vt cn tm kho xc nh bn r, iu ny
cng rt ngn nu thc hin php tm kho theo cch vt cn t hai pha.
b) M thay th
M thay th v bn cht xem php m ho v gii m nh l cc
hon v ca cc k t.
Theo nh ngha 1.1, cho R = M = Z26, k cha mi hon v c th
ca m k hiu. Vi mi php hon v K, ta nh ngha: e(x) = (x)
v d(y) = -1(y), trong -1 l hon v ngc ca .
Vi cc vn bn ting Anh khi cn m ho, mi kho ca m thay
th l mt trong 26! hon v. Do vy, p dng phng php tm kho
bng phng php vt cn s kh khn hn. M thay th c th d dng
b thm bng phng php thng k.
c) M hon v
tng ca m hon v l thay i v tr gia cc k t ca r.
Cho m l mt s nguyn dng xc nh no . Theo nh ngha
1.1, cho R = M = (Z26)m v k gm tt c cc hon v ca {1, , m}.
i vi mt kho (tc l mt hon v) ta xc nh:
e(x1, , xm) = (x(1), , x(m)) v:

RSA

CERT B

Public Key
B

Kho mt
m ho

Digital
Signature

RSA

HASH value
2

Public Key
A
CERT A

So snh

Kt qu
xc thc

Tm tt lun vn thc s

y 1(1 ) ,....., y 1( m )
d (y1, , ym) =
d) Cc h m dng
Bn cht ca m ny l to ra mt dng kho z = z1 z2 z3 v dng
n m ho mt xu bn r x = x1 x2 x3 theo quy tc
y= y1 y2=ez1(x1)ez2(x2)
nh ngha 1.2: M mt (m ho) dng l mt b (R, M, K, L, F, E,
D) tho mn cc iu kin sau:
1) R l tp hu hn cc bn r c th
2) M l tp hu hn cc bn m c th
3) K l tp hu hn cc kho c th (khng gian kho)

Thanh Bnh

Tm tt lun vn thc s

4) L l tp hu hn b ch ca dng kho
5) F = (f1 f2) l b to dng kho fi: K x R-1 L; i 1
6) Vi mi z L c mt quy tc m ez E v mt quy tc gii
m tng ng dz D tho mn dz(ez(x)) = x vi mi xP.
H m khi l mt trng hp c bit ca m dng khi dng kho
khng i zi = K, vi i 1.
1.2
H mt kho cng khai
1.2.1 Khi qut
H mt kho cng khai cho kh nng tnh ton xc nh quy tc
gii m (dk) l rt thp d bit y quy tc m ho ek. Quy tc m
ho ek c cng khai rng ri. u im ca h mt ny l ni gi c
th gi bn tin cho ngi nhn m khng cn thng tin trc v kho
mt. N gi nhn l ngi duy nht c th gii m thng tin nhn c
nh s dng quy tc gii m dk.
1.2.2 guyn tc m ho ca h mt kho cng khai
Trong h thng c N i tng cng trao i thng tin mt. Tng
i tng chn cho mnh mt kho lp m k v hm m ek c cng
khai. N h vy, c N kho lp m k1, k2, kn.
Khi mt i tng th i mun gi thng tin cho i tng th j th
d liu c chuyn thnh tng khi vi di no , mi khi P trong
vn bn c m ho bng kho lp m ekj ca i tng th j.
Thng tin gi i c dng: M = ekj(P).
gii m, i tng th j thc hin: dkj(M) = dkj(ekj(P)) = P
Do ekj v dkj l cp kho lp m v gii m ca i tng j nn i
tng khc trong h thng kh c th tm ra kho gii m dkj trong thi
gian chp nhn c vi phng tin tnh ton gii hn.
1.2.3 Mt s h mt kho cng khai thng dng
a) H mt RSA
H mt RSA c xy dng trn c s m m, trong kho lp m
l cp (b, n), gm s m b v mod n. Vi n = p.q, trong p v q l cc
s nguyn t; cn b c chn l mt s nguyn ngu nhin sao cho 1(b,
(n)) = 1, vi (n) l gi tr hm Euler ca n, v: (n) = (p - 1)(q - 1)
t R = M = Zn v nh ngha:
K = {(n, p, q, a, b)} v ab 1(mod (n))

Thanh Bnh

21

Tm tt lun vn thc s

Qu trnh gii m:
7) Gii m kho mt: s dng kho ring ca ngi nhn
(Private Key B) gii m kho mt.
8) Gii m d liu: s dng kho mt gii m ton b d
liu hoc vn bn in t, ch k v chng ch s.
9) Tnh gi tr bm ca vn bn: ton b d liu hoc vn
bn in t gc c a qua thut ton bm 1 chiu to
ra mt m nhn dng c tnh duy nht (Hash Value)
10) Kim tra tnh hp l ca vn bn: s dng kho cng khai
ca ngi gi (Public Key A) kim tra ch k s trn gi
tr bm ca vn bn kt lun v tnh hp l ca d liu
hoc vn bn:
1. N u kt qu kim tra ng, chng t thng tin l do
ngi gi gi (kho gii m cng cp kho vi kho m
ho); v ni dung thng tin cn nguyn gc sau khi k.
2. N u kt qu kim tra sai th chng t thng tin khng
phi do ngi gi gi (kho gii m khng cng cp
kho vi kho m ho); v ni dung thng tin khng
cn nguyn gc sau khi k

Thanh Bnh

20

Tm tt lun vn thc s

CHG 4 - CHG TRH M HO D LIU


4.1
Gii thiu bi ton
Mc tiu ca chng ny nhm xy dng mt chng trnh m ho
ng dng m hnh mt m RSA vi lc ch k s phc v bo mt
thng tin trong mi trng truyn tin, m bo cc yu cu sau:
 Bo mt thng tin trong qu trnh truyn tin. Thng tin c
m ho pha ngi gi v c gii m pha ngi nhn.
Vic thc hin m ho s dng thut ton m ho c
phc tp cao v thi gian thc hin nhanh.
 C c ch ngi nhn c th kim tra tnh hp l ca
thng tin nhn c (thng tin c gi i bi ng ngi
gi v khng b thay i ni dung trn ng truyn)
Chng trnh m ho c xy dng hot ng theo m hnh nh
sau:
Qu trnh m ho:
1) Tnh gi tr bm ca vn bn/d liu: ton b d liu hoc
vn bn in t c a qua thut ton bm 1 chiu to
ra mt m nhn dng c tnh duy nht (Hash Value)
2) To ch k s: m nhn dng ny c m ho bng kho
ring ca ngi k (Private Key A) to ra 1 ch k s
(Digital Signature)
3) ChuNn b d liu m ho: Gn ch k s ny v chng ch
s ca ngi k (Certificate A) vi d liu hoc vn bn
in t.
4) M ho d liu: ton b d liu hoc vn bn in t, ch
k s v chng ch s c m ho bng thut ton AES bi
mt kho m ho/gii m (kho mt) sinh ra ngu nhin cho
mi phin giao dch.
5) M ho kho mt: kho m ho/gii m sau c m ho
bng kho cng khai ca ngi nhn (Public Key B). Kho
cng khai ny c ly t chng ch s ca ngi nhn
(Certificate B)
Qu trnh truyn thng tin:
6) D liu v kho mt c m ho c gi n ngi
nhn qua cc knh truyn thng cng cng.

Thanh Bnh

Tm tt lun vn thc s

Vi k = (n, p, q, a, b) ta xc nh c :
ek(x) = xb mod n ; dk(y) = ya mod n
b) H mt RABI
nh ngha 1.3:
Gi s n l tch ca hai s nguyn t phn bit p v q; p.q 3 (mod
4);
Gi s R = M = Zn v xc nh:
K = {(n, p, q, B): 0 B n - 1}
vi k = (n, p, q, B) ta nh ngha:
ek(x) = x(x + B) mod n
v d k ( y ) =

B2
B
+y
4
2

Cc gi tr n v B c cng khai cn p v q c gi b mt.


c) H mt Elgamal
H mt Elgamal c xy dng trn bi ton logarithm ri rc. Vic
m t bi ton ny c thit lp trong trng hu hn Zp, p l s
nguyn t (bi ton logarithm ri rc trong Zp).
nh ngha 1.4: Cho p l mt s nguyn t sao cho bi ton
logarithm ri rc trong Zp l kh gii. Cho
thy. Gi s

P=

*
p

,C=

*
p

Z *p

l phn t nguyn

*
p

Z . T y ta nh ngha:

K = {(p, , a, ): a (mod p)}


Cc gi tr p, , c cng khai, cn a gi b mt.
Vi K = (p, , a, ) v mt s ngu nhin b mt k Zp, ta xc nh:
ek(x, k) = (y1, y2),
trong : y1 = k mod p ; y2 = x k mod p
vi y1, y2

Z *p

ta xc nh d k ( x , k ) = y 2 ( y 1a

mod p

d) H mt xp bal Merkle Hellman


nh ngha 1.5: Cho S = (S1, S2, , Sn) l mt danh sch cc s
nguyn siu tng.

Thanh Bnh

Tm tt lun vn thc s

p >

i=1
Cho
l mt s nguyn t v 1 a p 1. Vi 1 i n,
ta xc nh:
ti = aSi mod p v k hiu t = (t1,, tn).
Gi s p = {0,1}n, C = {0, , n(p-1)} v cho k = {(s, p, a, t)}, trong
s, a, p v t l cc s c xy dng nh trn, t c cng khai, cn p,
a, s c gi b mt.
Vi k = {(s, p, a, t)} ta nh ngha:

e k ( x 1 ,..., x n ) =

xiti

i =1

vi 0 y n(p - 1) ta xc nh: Z = a-1 y mod p


v gii m tp con (S1, .., Sn, Z) ta s nhn c: dk(y) = (x1,..., xn)
e) H mt McEliece
H mt McEliece s dng nguyn l tng t h mt Merkle
Hellman. Php gii m l mt trng hp c bit ca bi ton N P y
nhng n c ngu trang ging nh trng hp tng qut ca bi
ton. Trong h mt ny bi ton N P c p dng l bi ton gii m
cho mt m sa sai (nh phn) tuyn tnh ni chung.
H mt McEliece dng m Goppa c cc nhc im: dung lng
kho ln (512 K); m ho v gii m phc tp; cha c thut ton tm
m hu hiu.

Thanh Bnh

19

Tm tt lun vn thc s

iv) Dng thut ton Euclidean m rng tnh s nguyn d,


1<d<(n), sao cho e.d 1 (mod (n))
Kho cng khai ca A l (n; e) v kho ring ca A l (n; d)
3.5.2 Thut ton sinh v chng thc ch k RSA
a) Sinh ch k
i) S ho P thnh s nguyn m [0, n 1]; m = R(P);
ii) Tnh s = md mod n
iii) Ch k ca A cho thng ip P l s, gi s cho B.
b) Chng thc ch k
i) Xc thc ng kho cng khai ca A l (n, e)
ii) Tnh m = se mod n
iii) Xc nhn ch k ca A nu m MR
iv) Khi phc li P = R-1(m)
3.6 Cc kiu tn cng lc ch k s
Ch tn cng vo kho: Trong kiu tn cng ny i phng ch bit
kho cng khai ca ngi k.
Tn cng vo thng ip: i phng bit thm mt s vn bn no
v ch k tng ng ca chng. Tn cng vo thng ip li c
chia lm ba loi:
 Tn cng vo thng ip bit: Bit thng ip v ch k
tng ng ca thng ip nhng khng c chn la theo
ca i phng.
 Tn cng vo thng ip c chn: i phng c th chn
trc mt s vn bn v c ch k ca chng.
 Tn cng vo thng ip c chn thch ng: i phng c
th la chn cc vn bn ly ch k ngay trong qu trnh tn
cng (cn c trn kt qu ly ch k ca vc vn bn trc ).

Thanh Bnh

18

Tm tt lun vn thc s

Mi c th to mt kho ring dng k thng ip v mt kho


cng khai tng ng cc c th khc dng trong xc minh ch k.
 Mi c th A chn mt kho k = (k; k) K, Sigk l thut
ton k vi kho k.
R l mt hm sao cho R(M) = MR v c nghch o l R-1
 Thut ton Ver k l mt nh x t Ms n MR sao cho:
VerkSigk l nh x ng nht trn MR, k K. Verk gi
l thut ton chng thc c xy dng sao cho c th tnh
ton khi khng bit kho ring ca ngi k thng ip.
 Cp kho k = (k; k), trong kho cng khai ca A l k;
kho ring ca A l k.
Thut ton sinh ch k:
C th A k mt thng ip P M vi ch k s. Mt c th B bt
k c th cc minh ch k v phc hi thng ip P t ch k .
sinh ch k, c th A thc hin:
i) Chn mt kho k = (k; k) K
ii) Tnh m = R(P) v s = Sigk(m) (R l nghch o ca n l R-1
l cc hm c cng khai)
iii) Ch k ca A cho thng ip P l s, v s c gi n B
Thut ton chng thc ch k
xc thc ch k, B lm nh sau:
i) Xc thc ng kho cng khai ca A l k
ii) Tnh m = Verk(s)
iii) Xc minh rng m MR (nu m MR th t chi ch k)
iv) Phc hi thng ip P t m bng cch tnh R-1(m)
3.5 Lc ch k s RSA
3.5.1 Thut ton sinh kho cho lc ch k s RSA
Mi c th A lm nh sau:
i) Sinh ngu nhin hai s nguyn t ln p v q
ii) Tnh n = p.q v (n) = (p-1)(q-1)
iii) Chn ngu nhin mt s nguyn e, 1<e<(n) sao cho
(e,(n)) = 1

Thanh Bnh

Tm tt lun vn thc s

CHG 2 - H MT M KHO CG KHAI RSA


2.1 Gii thiu h mt
Bi ton: A mun gi cho B mt thng tin mt m A mun duy nht
B c th c c. lm c iu ny, B gi cho A mt chic hp c
kho m v gi li cha kho. A nhn chic hp, cho vo mt t
giy vit th bnh thng v kho li (lc ny ngay c A cng khng th
c li hay sa thng tin trong th c na). Sau A gi chic hp
li cho B. B m hp vi cha kho ca mnh v c thng tin trong th.
Trong v d ny, chic hp vi kho m ng vai tr kho cng khai,
chic cha kho chnh l kho ring.
mt ca RSA c da trn c s l hu nh khng c kh nng
khi phc hai s nguyn t p v q t tch n = p.q ca chng t nht l
theo vi cc thut ton phn tch ra tha s hin bit. Mt khc, cc
s nguyn t ln ngu nhin c th c to sinh nhanh chng
2.2 Phng php lp m v gii m ca h mt RSA
2.2.1 Thut ton
a) To kho
i) Chn hai s nguyn t ln p, q (p q) , tnh tch n = p.q
ii) (n) = (p - 1)(q - 1)
iii) Chn mt s nguyn e ln nguyn t cng (n), c
ngha: 1< e <(n) v (e, (n) = 1)
iv) Tm s d tho mn: e.d (mod (n)) = 1, 1<d<(n) bng gii
thut Euclidean m rng
B ba (n; e; d) l cha kho ca h m, vi kho cng khai ca B l
(n; e) v kho ring ca B l (n; d).
b) Lp m
i) S dng kho cng khai ca B l (n, e)
ii) Biu din thng ip di dng s, gi s l s nguyn m
sao cho: m [0, n-1]
iii) Tnh C = me mod n
iv) Gi bn m C cho B
c) Gii m
i) Dng kho ring d ca B tnh m = Cd mod n
ii) Khi phc thng ip t hm ngc ca hm s ho c P

Thanh Bnh

Tm tt lun vn thc s

2.2.2 c trng ca h mt RSA


H mt RSA c cc c trng sau:
 Khng cn phi thit lp mt knh bo v phc tp
truyn kho nh trong h m b mt.
 Cp kho cng khai c to ra theo mt phng php c
bit c quan h vi nhau v c chn trong nhiu kho c
th (trong nu kho ny dng m ho th kho kia
dng gii m).
 ng vi mt cp p, q c th chn c nhiu b kho cng
khai (n; e; d)
 Mi ngi trong h thng nu nhn c bn mt C th
cng khng th bit c bn r P. Vi vic ch bit kho
m ho ke v cn c vo cc thng tin v thut ton th
khng th tm ra kh gii m kd trong thi gian chp nhn
c (k c dng h thng hin i nht tnh ton).
N gun cp kho
ca B
Kho cng khai

Kho b mt

eb

db

C=
Bn gi A

M ho

P eb mod n

P=

C db mod n

Gii m

Bn nhn B

Hnh 2.1: Qu trnh m ha kha cng khai RSA

Qu trnh gi v nhn thng ip (bn tin) c thc hin nh sau:


i) Mi thnh vin sinh mt cp kho (n; e) v (n; d).
ii) Cng khai kho (n; e); gi b mt ho (n; d).
iii) A gi thng ip cho B th A m ho thng ip bng kho
cng khai (n; eb) ca B.
iv) B gii m thng ip bng kho ring (n; db). Khng mt
ngi no khc c th gii m thng ip ngoi B, v ch c
B mi bit kho ring ca mnh.
2.3 an ton ca h mt RSA
an ton ca h mt RSA th hin qua hai yu t:

Thanh Bnh

17

Tm tt lun vn thc s

Thut ton sinh kho:


 Mi c th A chn mt kho k = (k; k) K, Sigk l thut
ton k vi kho k
 Thut ton Verk tng ng l mt nh x t MhxMs n tp
hp {True, False} sao cho:
True , nu y = sigk(x)
Verk(x ;y) =
False, nu y sigk(x)

Vi kho k = (k; k), trong kho cng khai ca A l k;


kho ring ca A l k
Thut ton sinh ch k:
C th A thc hin:
i) Chn mt kho k = (k; k) K
ii) Tnh m = h(P) v s = Sigk(m)
iii) Ch k ca A cho thng ip P l s, P v s c gi n B.
Thut ton chng thc ch k:
Xc thc ng kho cng khai ca A l k:
i) Tnh m = h(P) v u = Verk(m; s)
ii) Chp nhn ch k ca A nu v ch nu u = True
Cc thuc tnh sau l yu cu cn thit cho cc thut ton k v
chng thc:


Vi mi kho k = (k;k) K, Sigk c tnh ton hiu qu


Verk cn tnh ton mt cch hiu qu
Ch c A c th tm c bn r P M v mt s Ms sao
cho Verk(m; s) = True, y m = h(P)
b) Lc ch k t khi phc thng ip gc
C c im l thng ip c k c th c phc hi t ngay
ch k v thng c dng k cc thng ip nh.
nh ngha: Lc ch k s khng i hi phi c thng ip
gc lm u vo xc minh ch k c gi l lc ch k t khi
phc thng ip gc, trong trng hp ny thng ip gc s c phc
hi chnh t ch k ca n.
Thut ton sinh kho:




Thanh Bnh

16

Tm tt lun vn thc s

Trong :
 Ks gi l mm kho hay cn gi l kho khi tho c
chn theo phng php ngu nhin.
 Hai thut ton F, G dng tnh ton cc kho. A dng hai
thut ton F v G cng vi mm kho ks to ra hai kho:
kho gii m kd l kho ring c gi li s dng ring cho
mnh v kho ke cng khai thng bo cho mi ngi.
 P l thng ip gi i, S l thng ip sau khi k.
 E k d : Thut ton m ho vi kho kd.


Dke : Thut ton gii m vi kho ke.

3.4.2 nh ngha lc ch k s
Mt lc ch k s l mt b (M, Ms, K, S, V) gm:
 M l tp hp hu hn cc vn bn c th
 Ms l tp hp hu hn cc ch k c th
 K l tp hp hu hn cc kho
 S l tp hp cc thut ton k
 V l tp hp cc thut ton chng thc ch k.
Mi k K l mt cp (k; k) trong k l kho b mt dng k,
k l kho cng khai dng kim th ch k.
Vi mi k = (k; k) K. C mt thut ton k Sigk: M Ms (Sigk
S) v mt thut ton kim th Verk: M x Ms {True, False}(Verk
V). Tho mn iu kin sau y i vi mi xM, yMs:
True , nu y = sigk(x)
Verk(x ;y) =
False, nu y sigk(x)

3.4.3 Phn loi lc ch k s


a) Lc ch k km theo bn r
Loi lc ny dng ph bin trong thc t. Chng da vo cc
hm bm mt m hn l cc hm tha tu bin v t b cc tn cng gi
mo hn.
nh ngha: Lc ch k s m yu cu phi c thng ip gc
l u vo cho thut ton chng thc ch k c gi l lc ch k
s km theo bn r.

Thanh Bnh

Tm tt lun vn thc s

Tnh mt ca h RSA, ch yu da vo vic bo v kho


ring d v gi b mt cc s nguyn t p v q.
 Tnh an ton ca h RSA da vo kh ca bi ton RSA
v phc tp ca bi ton phn tch mt s thnh cc tha
s nguyn t
Vi ngi thm m c th tn cng vo h m RSA theo cc hnh
thc:
 Vt cn: khng gian kho ca RSA l rt ln v vy tn cng
theo hng ny l khng th thc hin c.
 Da trn c s ton hc tm cch phn tch modulus n
thnh cc tha s nguyn t.
2.4 Qun l kho ca h mt m RSA
2.4.1 Phn phi kho cng khai
a) Phng php khai bo cng khai
Bt k thnh vin no cng c th thng bo kho cng khai ca
mnh cho cc thnh vin khc c bit.
Gii php ny c nhc im l bt k ai cng c th gi mo mt
kho cng khai.
b) Phng php s dng th mc cng khai
Vic duy tr v t chc mt th mc cng khai thuc v mt t chc
c tin cy no . Mt lc nh vy bao gm cc yu t sau:
 T chc c nhim v duy tr th mc, mi thnh vin c
mt entry (nh danh, kho) trong th mc.
 Mi thnh vin ng k mt kho cng khai vi t chc
qun l th mc.
 Mi thnh vin c th thay th mt kho cng khai bt c
lc no khi cm thy kho ring b l
 C quan qun l cng b ton b th mc v c nhim v
cp nht th mc mt cch nh k.
 Mi thnh vin u c th truy nhp vo th mc bt c lc
no, v th vic truyn thng xc thc an ton (t c quan
qun l n cc thnh vin) phi mang tnh bt buc.
c) Trung tm qun l kho cng khai


Thanh Bnh

10

Tm tt lun vn thc s

Mt c quan trung tm duy tr mt th mc kho cng khai. Mi


thnh vin u bit kho cng khai ca trung tm qun l kho cng
khai, nhng ch c trung tm ny bit kho ring cng cp.
Qu trnh trao i thng tin b mt din ra nh sau:
i) A gi mt thng ip c gn nhn thi gian cho c quan
qun l kho cng khai, yu cu kho cng khai hin thi
ca B.
ii) C quan qun l tr li bng mt thng ip. Thng ip
ny c m ho bng kho ring dauth ca c quan qun l
bao gm:
1. Kho cng khai eb ca B (A c th dng n m ho
cc thng ip gi cho B)
2. Yu cu gc (request) A so khp yu cu ny vi yu
cu A gi i trc , nh A c th bit yu cu
gc c b sa i trc khi c quan qun l nhn c
hay khng.
3. N hn thi gian gc cho php A xc nh c rng:
y khng phi l mt thng ip c m l thng ip
c cha kho cng khai hin thi ca B.
iii) A lu gi kho cng khai ca B v s dng n m ho
mt thng ip gi cho B, thng ip ny cha tn ca A
(IDA) v mt gi tr (c gi l nonce) N 1 nhn dng
giao dch ny.
iv) B ly kho cng khai ca A t c quan qun l kho (tng
t nh A ly kho cng khai ca B).
N h th l A v B chuyn giao kho cng khai mt cch an ton,
v h c th gi v nhn tin ca nhau.
d) Phng php s dng chng ch kho cng khai
Cc thnh vin s dng chng ch trao i kho m khng cn
lin lc vi c quan qun l kho cng khai. Mi chng ch cha mt
kho cng khai v cc thng tin khc. N c mt c quan qun l
chng ch to ra v pht hnh cho cc thnh vin. Mi thnh vin thng
bo kho cng khai ca mnh cho cc thnh vin khc thng qua chng
ch.
c trng quan trng ca chng ch l: Cc chng ch c th c
pht hnh m khng cn phi bo v thng qua cc dch v an ton

Thanh Bnh

15

Tm tt lun vn thc s

thay i (d ch l 1 bit) th kt qu ca du vt thng ip cng s thay


i.
N gi ta thng s dng s h tr ca cc hm bm mt m trong
qu trnh s ho ca cc lc k. Hm bm mt m phi c tnh cht
sau:
 L hm mt chiu
 Khng tm c xung t: tc l rt kh tm hai vn bn
P v P c cng m bm.
Mt du vt thng ip phi c hai thuc tnh thit yu sau:
 N u mt bit hoc mt vi bit ca d liu b thay i th du
vt thng ip cng b thay i.
 Mt ai c mun gi mo th cng khng th a ra mt
thng ip gi cng vi mt du vt thng ip tng ng
ging nh bn gc trong thi gian chp nhn c.
3.4 Lc ch k s dng mt m kho cng khai
3.4.1 Hot ng ca ch k s
N u A gi cho B mt bn tin c m ho bng kho cng khai ca
B th B c th gii m bng kho ring ca mnh c bn tin m
nhng ngi khc khng lm c. N gc li, B c th k vo mt
bn tin bng kho ring (chng thc) v gi cho A, sau A c th
kim tra tnh xc thc ca ch k bng kho cng khai ca B.
ks

Kho cng khai

G
ke
kd
D

E
P

B mt ca A

S= E k (P)

P= Dk (s)

Hnh 3.1: S nguyn l hot ng ca ch k s dng mt


m kho cng khai

Thanh Bnh

14

Tm tt lun vn thc s

3.3

Xc thc thng ip
Xc thc thng ip l mt th tc nhm kim tra cc thng ip
nhn c, xem chng c n t mt ngun hp l v c b sa i hay
khng. Xc thc thng ip cng c th kim tra trnh t v tnh ng
lc. C nhiu k thut xc thc thng ip: N gay trong h m b mt
ngi ta cng cp n vic xc thc thng ip, ch k s cng l
mt k thut xc thc, n cng bao gm nhiu bin php chng li
vic chi b gi hay nhn thng ip.
3.3.1 M ho thng ip
i) Trc tin A s dng kho ring ca mnh m ho (k)
thng ip P c s = Ekda (P)
ii) Tip tc dng kho cng khai ca B (nhm m bo tnh b
mt) m ho ch k s c bn m
C = E k e (s ) = E k e E k e (P ) , C c gi n B.
b

B s dng kho ring ca mnh gii m thng ip v sau


dng kho cng khai ca A xc thc ch k.
3.3.2 K thut xc thc dng kho b mt
A v B c chung mt kho b mt k. Khi A mun gi mt thng
ip P cho B, quy trnh c thc hin nh sau:
i) A tnh ton MAC qua mt hm C vi kho k: MAC = Ck(P)
ii) Thng ip P cng vi MAC c gi cho B, B tin hnh
tnh ton MAC trn thng ip nhn c tng t nh A
tnh, sau so snh MAC tnh c vi MAC nhn c
t A. N u trng khp th:
- B tin chc rng thng ip khng b sa i
- B m bo c rng thng ip c gi mt cch hp
php t A (v ch c 2 ngi bit kho b mt nn khng
ai c th chuNn b mt thng ip vi mt MAC hp l)
3.3.3 Cc hm bm
Vi cc d liu c di khc nhau bt k khi c cho qua mt
thut ton bm mt chiu th s c bm ra thnh cc chui c chiu
di kh nh v c nh nh nhau c gi l du vt thng ip
(message digest). Thut ton ny bo m rng, nu ni dung d liu b

Thanh Bnh

11

Tm tt lun vn thc s

truyn thng m bo b mt, xc thc v tnh ton vn. Bi v cc


chng ch c kh nng t bo v bng ch k s ca CA.
Li ch ca chng ch kho cng khai l mt ngi s dng c th
c c mt s lng ln cc kho cng khai ca cc thnh vin khc
mt cch tin cy ch cn thng qua kho cng khai CA.
2.4.2 S dng m ho kho cng khai phn phi kho mt
Lc Merkle: th tc A trao i thng tin mt vi B:
i) A to ra mt cp kho (ea, da) v truyn cho B kho cng
khai ea v tn ca A (IDA).
ii) B to ra mt kho b mt Ks v gi cho A: E e a (K

).

( )) = K

iii) A tnh ton bit kho b mt Ks: D d a E e a K

iv) A hu b ea, da v B hu b ea.


By gi A v B c th trao i vi nhau bng kho phin Ks. Sau khi
trao i xong c A v B cng hu b KS, nh vy theo cch ny th vic
m bo b mt l rt tt v trc v sau khi lin lc khng c kho no
tn ti.
2.5 Cc tn cng i vi h mt m RSA
2.5.1 Tn cng trong qu trnh to kha
Vic tm ra 2 s nguyn t ln p v q thng c thc hin
bng cch th xc sut cc s ngu nhin c ln ph hp v p v q
cn c chn khng qu gn nhau phng trng hp phn tch n
bng phng php phn tch Fermat. N goi ra, nu p-1 hoc q-1 c tha
s nguyn t nh th n cng c th d dng b phn tch v v th p v q
cng cn c th trnh kh nng ny.
2.5.2 Tn cng lin quan n tc
RSA c tc thc hin chm hn ng k so vi DES v cc thut
ton m ha i xng khc. Trn thc t, Bob s dng mt thut ton
m ha i xng no m ha vn bn cn gi v ch s dng RSA
m ha kha gii m (thng thng kha ngn hn nhiu so vi
vn bn).
Phng thc ny cng to ra nhng vn an ninh mi. Mt v d
l cn phi to ra kha i xng tht s ngu nhin. N u khng, k tn
cng (thng k hiu l Eve) s b qua RSA v tp trung vo vic on
kha i xng.

Thanh Bnh

12

Tm tt lun vn thc s

2.5.3 Tn cng vo qu trnh phn phi kho


Qu trnh phn phi kha cn chng li c tn cng ng gia
(man-in-the-middle attack). Gi s Eve c th gi cho Bob mt kha bt
k v khin Bob tin rng l kha (cng khai) ca Alice. ng thi
Eve c kh nng c c thng tin trao i gia Bob v Alice. Khi ,
Eve s gi cho Bob kha cng khai ca chnh mnh (m Bob ngh rng
l kha ca Alice). Sau , Eve c tt c vn bn m ha do Bob
gi, gii m vi kha b mt ca mnh, gi 1 bn copy ng thi m ha
bng kha cng khai ca Alice v gi cho Alice. V nguyn tc, c Bob
v Alice u khng pht hin ra s can thip ca ngi th ba. Cc
phng php chng li dng tn cng ny thng da trn cc chng
thc kha cng khai (digital certificate) hoc cc thnh phn ca h tng
kha cng khai (public key infrastructure - PKI).
2.5.4 Tn cng da trn thi gian
N u k tn cng nm thng tin v phn cng thc hin m ha v
xc nh c thi gian gii m i vi mt s bn m la chn th c
th nhanh chng tm ra kha d. Dng tn cng ny c th p dng i
vi h thng ch k in t s dng RSA.
Mt dng tn cng thc t: phn tch tha s RSA dng mng my
tnh (My ch web dng SSL). Tn cng khai thc thng tin r r ca
vic ti u ha nh l s d Trung quc m nhiu ng dng thc
hin.
chng li tn cng da trn thi gian l m bo qu trnh gii
m lun din ra trong thi gian khng i bt k vn bn m.
2.5.5 Tn cng la chn thch nghi bn m
Dng tn cng la chn thch nghi bn m (adaptive chosen
ciphertext attack) c th thc hin trn thc t i vi mt vn bn m
ha bng RSA. Vn bn ny c m ha da trn tiu chuNn PKCS #1
v1, mt tiu chuNn chuyn i bn r c kh nng kim tra tnh hp l
ca vn bn sau khi gii m. Do nhng khim khuyt ca PKCS #1,
Bleichenbacher c th thc hin mt tn cng ln bn RSA dng cho
giao thc SSL (tm c kha phin). Do pht hin ny, cc m hnh
chuyn i an ton hn nh chuyn i m ha bt i xng ti u
(Optimal Asymmetric Encryption Padding) c khuyn co s dng.
ng thi phng nghin cu ca RSA cng a ra phin bn mi ca
PKCS #1 c kh nng chng li dng tn cng ni trn.

Thanh Bnh

13

Tm tt lun vn thc s

CHG 3 - LC CH K S RSA
3.1 Khi nim ch k s
Ch k s l mt phng php k mt thng ip lu di dng
in t.
Ch k s khng gn theo kiu vt l vo ti liu m gn theo kiu
logic vi ti liu.
V vic kim tra ch k: ch k s c th c kim tra bng cch
s dng thut ton kim th cng khai. V vy bt k ai cng c th
kim th ch k s. Vic dng mt lc ch k s an ton c th
ngn chn c kh nng gi mo.
Bn sao chp ca ch k s ng nht vi bn gc. iu ny c
ngha l phi cNn thn ngn chn mt thng ip ch k s khi b dng
li.
Mt lc ch k s bao gm 2 phn: 1 thut ton k v 1 thut
ton kim th.
3.2 ng dng ca ch k s
H thng th tn in t: sau khi mt bn to ra bn tin, bn c
th k v gi sang bn th hai, sau khi xc minh bn tin nhn c, bn
th hai c th tin tng rng bn tin c k bi bn th nht, bn
th hai cng s bit rng bn tin khng b thay i sau khi bn th
nht k n.
H thng chuyn tin in t: ch k c s dng cho bn tin
chuyn tin trc khi n c gi i v do vy bn nhn s xc minh
c rng bn tin nhn c l chnh xc v yu cu chuyn tin cng
khng th b chi b.
Cc ng dng thng mi: thanh ton in t, trao i thng tin in
t, in vo cc bn tin thu v cc ti liu php quy khc, bn hng trc
tuyn v cc giao dch dng card.
Bu c s: ngi dn xc minh r rng rng phiu bu thuc v h,
trnh vic bu qu.
Phn phi phn mm: mt ch k s c p dng cho phn mm
sau khi n c hon thnh v c chp thun phn pht. Trc khi
ci t phn mm trn mt my tnh, ch k cn c xc minh chc
chn rng khng c s thay i no ngoi thNm quyn (v d nh s
thm vo ca mt viruts). Ch k s cng c xc minh mt cch nh
k chc chn s ton vn ca phn mm.