0% found this document useful (0 votes)
16 views6 pages

Cns Assignment 4

Uploaded by

Karthik Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

Cns Assignment 4

Uploaded by

Karthik Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Asgonent-4

Hlouw ae the publi and private keys gene rated ?


A9: Public and private teyt are qene sated using crqPtoqtpnic alqprthm,
typi cally bated on pubic -key cIyptoqiaphy
Public- key yptogaphy Baticsi
Eey Pair generation - Create a paiY of kes,one PublC and one praate.
2-Public Keyi- Gared openly usled for enoypton.
.Portvate key:- kept secret used ox ceeryption.
key henerotion Proces
(·Choose an tlqOsithm
Common algorithm include:
RSA (Rivest -shams-Adleman)
2-E lipti lurve ayptoqaphy Ctcc)
3.DiPPie -telman (DH)
2 .Chenerate key Pos -
RSA Ley Greneration
I.Choose too larqe pimehumbesa Pand.
2. cqlculate n Ptq (modulus).
3. Calculate en) (P-D*(2-i) (Euler's totient).
4. Choase a(public eAPonent)such that kee an)andqcd le d)):|.
5. Calculate dPVate enponent) uch that dte
i(nd on)).
6 -fublic key:le,n)
4. Poivate key :(dn)
ECC Kef Chenerationb
t. Choose an el;ptic urve and a base pont
2. brenerate a private ceyld)as a vandom rumber.
3. Calceulate the publtc key (¡) usinq font multiptation : @d¥eË.
3. key fomat -
Keys are tyPically stooed in farmats (rke:
(. PEM (RiVacy - Enhanced Mai)
2 . DER (D;Stinguihed Encocding Rules)
3.Pt cs#2(Publc-tey Cry ptoq ta phy Standard)
70014 foy key eneralion
I.opensSL
2·OpensH
3. GnlGiNUPsivaty aard)
aCayttoqcaphic hbyojis legNacl,(ne ungvatlable))
ieitant Consderationg:
1-key size -korqer keys povde Staonger searity
R.RandomneSS-Ensure
5. key stoOge :- Sec radom nunber qenciation for ceiare re
uYely Store priate keyt
4-key manaqemnt Manaqe bet IHecycles.TeVOCation, ard totaton.
2|Wlhat s the dole o prime
numbet in the ley qeetation pnCesS?
-A- Poime numbs play a Crulical xale in the
keey qeneration process for the
Public-key cryptoqaphy aqoithms uch as RIA.
Role o Potime Numbers
1.keq size determination - Brime
numbez determine the key si2eiwhich the
affectt sSecuritt
2.M0dulus calclation:- ime numbet are used to alculate he
madulus cn)
-for RSA.
s.Pubic and private enponent
Calculation:-Pthne numberz help caalate pubi
te) ard
private d)enponen t
u-tnryption avd decryption- Pottrme numbers ensyre Secure
encrypton and
ttowRrime Numberd are decrqgtion.
(.RCA ey used
-choose twoGeneration:
arqe prime numbes
- calceala te Pard
nptq Cmdulu).
-Calculate o n)=(p-)a-1)ltulert to;tent).
- choose e
-calcalate
CAublicenponent).Sch that <ec Qn) and gcdle
an)):|
dCPrivate enponent) uch that de Cmod n)).
2-ENiptic urve ciyptoqvaphy (tc)>
- Peime humbiK detine the elliPtic Curve
Parameters.
Péyate teey ld) qenerated asaiardom nmber.
-Rubte fay l0) s caltulated ulng toint mattiplation.
Petopertil of Prime Numbed -
(.UNiqueness?-Patme numbrn ensure unique leey paixk.
2.Large si2ei- karge prime numbek pro Vide (ttong seeutity.
|3.Randomne :-Random prime numben prevent Pedi (tabe keys
seure keyg.
. Distribution: Potme numbet are disttibutd eveny,ensuring
Requiremen te fog Pime Numbes :
I. Sizei-Typitally o24-bit or larqer
2Randomnes:- benera ted ardomly to prevent predictabi lity
3.Ohiqueneas Fnsure cunique prime numbez for each cey Pa'r
aTesting Patme numbes are tested for primality.
Poime Number henctationAlqorí thmi
|.sal Divilion
2 Miller-Rabin Pomality Tes t
3-AAS oti mality Test
q- Random Numbur Generation (RNos)
Tools for prime Number heneration
OPenssL

3-(ryptoqapbic lbaries (e q-,Na)


Speciaized prme Nunber qeneratton (eg-.Prime q5).
3. Enpain the Sqnifilance of the modulus nard the totentin) tnqererating
the ey
A!- în eSA Ley qeneration ,the moolulus n and the totient qh) Pag critical
roles.
Modulus n
1.lalc lated a n=ptqherep and a are brge prime numbus.
2.ns the modulus used for both public and pr vate leey operations
2.Si2e ot ndetermines the tey Size e-q. to2s -bit, 20uf- bt).
uLarqe nprvidu tthorqer Security agatntt factoriaation attacks.
Totient ptb):
t. Calculated as Q
th) (-1)+(4-1) ulng Eulerk foiteat function.
2 pn)representH the nmber of inteqer es thann that are the relgtivelo
Patme to n.
B-Used to ensee the private enponent d S
Coprime to (yn).
4tcsential for ettiient deryptiorn and signature verititation
Siqnitiance
I.Eey generationn and Qen) enable (qlula tion of Riblic erpOnent e and the
potvate enponent d.
2tn(ryptioni nis used for encrypton operations
(eqiC= m^e mod n).
3. Deciyption:- n and(Qln)faclitate effitient decsyption .
e.q.m= C^d moal n).
4Seeurityt ?- kage n ard Caoetuliy Chasen e and d ensure veiltance b factortz
-ation and ducrete logrithm attack4.
PaDpertiesi
(.nisa poduct of tuo prmel makiq factYization ditlicalt:.
2. (Qln) Usebtively prne ton, ensurig efftent modular arthmetic.
3. e andd are coprime to Qn),ensuring Secure eneyption ard
decsyption.
Keg Generation teps -
| Choose large prime
numbes pandq.
2.Calcelate n=pt,
3. Calculate uln) (p4) 9-1)
u- Chooe Pudic enponent esuch
that
lcec Qln) and q dle, rCn))=|.
5-calculate po;vate enponent. dSch that dte (mod gln)).
Bxample
Suppose P=blandq=53.
(.n=61*53-3233.
2. (pCn) (6l-) t(53-1)= s20
s -choose e-7( Co paime to
(n)).
s. Calcelate d= S453 (P\vate enponent.
u.Given the tollouing values for an RCA SYstem :
Paolc bey".le4 :55)(e =1, n 56)
Private ky: d=23, n: 55) d-28,n 55)
Mesaqe m s2 m-02 .
a) Enciypt the mesoqe mm er;ng the publlc tey
Decrypt bhe lesulting Cphe teub utaq the priate key.
q6(mod
55)
s)I3^us2
(mod
55) (mod Bz=6
artheelici modular usinot
Calculate:m3
b3) (nod ^23 4:
formula:m=c'
(mod d
n) -Deeryption 3
ep)
cteneryption (Fsom C-3 tent:2.Cipher
23,0-55)
DeCt:key:tdyptioPoivate
n |. )
tent:c=13. Cpher
EB(mod
5)
(15)) (med =3)
(56))E19Umod
5 ) (mod 2us AL
Squaring: uz42E(46u(b5m) od 5lu) Cmod =
repeated usAlingtenatveky
C-13 tent Cipher
s5) (mod u241
u244=uu)k(uA2y^)+(7u)^1E5 )uz(mod 55) (tmu*od 3
55) mod *u2
arithetic: modular Utng
-omui(an)
m:ocdl=m^e 3.tncrypton
aqemeu 2-Mes
n-55)keile-4. I:Publlc
e thq procetde, (yptin Enrpton -Aya)
enandnption Modular
the invovetnardthnetie
step al Shouw
)
3^8 3A2 (mod 5)
461(mod 95)
51(mocl 59)
|3^16 =5^2,(mod 55)
260l (mod g9)
36 (mnod 55) 55J
|6*|3nut [2 , *(3^J Cmod
I3>3= (3^
36t3(tiyt |3 (mod (5o))
2(mod 55)
Decrypted mecSaqe :m=02
melage
The decrypted message matches the oriqinal
c)Steps in volved tn enuyption and decrypti on
EnCYption :
1. Convert esaqe to numerital sepresentation (m =u2).
2Caculate cE m^e Cmod n.
3.Pedu Ce result modulo nc=l3 (modb5).
De cryption :
(. Receive cipher tent (c -B).
2. Caltulate m=d Cmod n)
3. Reduce result modulo n (m uelmod 59).
Modular asithmetic paoperties used:
|Fermaty Cittle Theorem (a^(0-)=(nod p)).
2.tuler theorem (a(un))=i(nod n)
3.Modular enponentiatian (repeated squari)

You might also like