Vous êtes sur la page 1sur 8

International Journal of Computer and Engineering

Vol 1, Issue 1, 2010


ResearchArticle

IMPLEMENTATIONOFRSAALGORITHMWITHAUTOGENERATEDLARGEKEYSANDPRIME
TESTINGWITHOPTIMALSECURITYPARAMETERFORMILLERRABINALGORITHM

SATYENDRANATHMANDAL1,KUMARJITBANERJEE2,J.PALCHAUDHURY3
Dept.ofI.T,KalyaniGovt.EnggCollege,Kalyani,Nadia(W.B),India,2ASET,TataConsultancyServices,3Dept.ofI.T,KalyaniGovt.Eng.
College,Kalyani,Nadia(W.B),India.Email:satyen_kgec@rediffmail.com,kumarjit.banerjee@tcs.com,jnpc193@yahoo.com

Received:28April2010,RevisedandAccepted:19May2010
ABSTRACT
TheRSAcryptosystem,inventedbyRonRivest,AdiShamirandLenAdlemanwasfirstpublicizedintheAugust1977issueofScientificAmerican.
The security level of this algorithm very much depends on two large prime numbers. But, to check large number whether it is prime or not in
personalcomputerishugetimeconsumingusingtrialdivisionalgorithm1.Inthispaper,systemdateandtimewithaparameteraspowerisusedto
generatelargenumbersofdesiredlengthandtheMillerRabinalgorithmisusedfortestingtheprimes.Thepaperisdividedintotwoparts.Inthe
first part, two large prime numbers generated by MillerRabin algorithm from auto generated number combining system time and date. In the
second part, a modification has been done on security parameter of MillerRabin algorithm. Optimal security parameter has been computed
dynamicallyforagivennumberwhichistakenconstantpreviouslybeforeusingtheMillerRabintest.Anencryptionanddecryptionhasbeendone
onatextfileusingRSAalgorithmandprimeischeckedbyMillerRabinalgorithmwithoptimalsecurityparameter.Finally,timerequiredforprime
generationandencryptionanddecryptiontimefordifferentfileformatsofdifferentsizeshasbeenfurnishedintabularform.

INTRODUCTION
Securityinnetworkingisbasedoncryptography 2,thescienceandartoftransformingmessagestomakethemsecureandimmunetoattack 3.The
RSA4algorithmisthemostpopularandproven asymmetrickeycryptographicalgorithm4.Forlargertheprimes,tougheristhe factorization 5,6,7.
ThismakestheRSAsecure8.Nowmovingontothediscussiontotestanumberisprimeornot,oneoftheearliestmethodsisthetrialdivision.Even
afterseveralmodificationsofthetrialdivisionalgorithm,thenumberofstepsinvolvedforagivennumberm,atmostkbitslong,isthenumberof
timesithastobecheckedfrom2,3,6*p1uptom,wherepisaninteger19,20,17.Sothenumberofstepsisapproximatelyequaltom/3(2k)/3=
(2k/2)/3.CMU'sProfessorGaryMiller 3hadabetterideain1975.BasedonthattheMillerTestisconstructed.ThisislatermodifiedasMillerRabin
Test.
Inthispaper,two large numbers aregeneratedfromsystemtimeand date takenat the time ofexecution ofthisprogram. Toproduce thelarge
number, it is multiplied by itself iteratively depending on the value of power (Table 1). These numbers are tested with MillerRabin algorithm
whether they are prime or not. If the number is not prime then the next prime is computed by adding two if the number is odd and one if the
numberiseven.Theprocessisrepeateduntiltwoprimesarenotfound.ThebasicproblemoftheMillerRabinalgorithmissecurityparameteris
constant.Thesecurityparameterisanindicationofprobability 5,6,4,16withwhichthegivennumberistobetested.Foragivent,theprobabilityof
failure(P(f))oftheMillerRabintestisgivenby,P(f)=1/2t.Nowift=10(say),thenP(f)=0.0009765625.Nowthegivennumberissaya4digit
number.Thenthetestishighlyreliable.Butifitisa1000digitnumber,thetestmayreturnacompositenumbertobeaprimenumber.Thenthe
securityparametershouldbeincreased.Nowtheproblemishowtoincreasethesecurityparameter.Ifitisincreasedarbitrarily,theneitherthere
willbealowsecurityparameterforalargenumberorahighsecurityparameterforsmallnumber.Howeverthefirstproblemmayresultinafailure
for it may return a composite number as a prime number. The second problem is that it will return the correct result but a huge time will be
requiredtotestitwithahighsecurityparameterwhichisalsonotatalldesirable.Theproblemistofindtheoptimalsecurityparameterwhichwill
overcomeboththeproblems.Inthispaper,thesecurityparameteriscalculateddynamicallydependingonthenumberofdigitsofthenumber.Thus
itassuresthereliabilityoftheMillerRabinalgorithmandtheRSAalgorithmisimplementedwiththetwoprimessoformedaspandq.
Thispaperhasbeendividedintoseveralsections.Thefirstfewsections(2,3,4)containtheexitingtheoremsandidentitiesincludingFermatslittle
theorem,milerrabintestandtheRSAalgorithm.Next comesthetheorybehind calculatingtheoptimalsecurityparameter(5). Finallytheresult
contains the time required for prime generation and for encryption and decryption of different file formats of different sizes. In the conclusion,
discussionhasbeenmaderegardingtheresultobtained,futureworksandreferencesarediscussedinthelastthreesections.
Existingtheoremandtestforprime
Fermatslittletheorem
Ifmisprimeand1a<m,thenam1=1modm.Thissuggestsawaytoprovethatanumberiscompositewithoutactuallyfactoringit.If1a<mis
suchthatam1 1modmthenmisnotprime.Buthowever,theconverseofFermat'sLittleTheoremisfalse.RobertCarmichaelshowedthereexist
nonprimesmsuchthatam1=1modmforalla0(modm)17.ThesearecalledCarmichaelnumbers.SoProf.MillerdesignedtheMillerTest.
Millertest(m,a)
1.Computeam1(modm);if1thenoutputcomposite.
2.Checkifanyoftheintermediatepowersconstructedinthepreviouscomputationarenontrivialsquarerootsof1(i,e,satisfyx2=1(modm),and
alsox1(modm).Ifsooutputcomposite.Ifanumber1a<mcausesMillerTest(m,a)tooutputcomposite,thenaisawitnessform.This
algorithmlatermodifiedasMillerRabinAlgorithm.
Anyprimeotherthan2and3isoftheform6*p1forsomeintegerp
Proof
Fromthedivisionalgorithm,anyintegercanbewrittenasanyoneofthefollowingforms:

Mandaletal.
IntJCompEngg,Vol1,Issue1(2010),813
6*k,6*k+1,6*k+2,6*k+3,6*k+4,6*k+5
Now,
1.Thenumberswhichareoftheform6*karenotprime.
2.Thenumberswhichareoftheform6*k+2arenotprime,since6*k+2=2*(3*k+1).
3.Thenumberswhichareoftheform6*k+3arenotprime,since6*k+3=3*(2*k+1).
4.Thenumberswhichareoftheform6*k+4arenotprime,since6*k+4=2*(3*k+2).
Sotheonlychoicesleftare6*k+1and6*k+5.
Again,6*k+5=6*(k1)1=6*p1forsomeintegerp;
Hence,anyprimeotherthan2and3isoftheform6*p1forsomeintegerp.(Proved)
RSAalgorithm
Incryptography,RSAisanalgorithmforpublickeycryptography.Itisthefirstalgorithmknowntobesuitableforsigningaswellasencryption,and
oneofthefirstgreatadvancesinpublickeycryptography.RSAiswidelyusedinelectroniccommerceprotocols,andisbelievedtobesecuregiven
sufficiently long keys and the use of uptodate implementations. The RSA algorithm involves three steps: key generation, encryption and
decryption.
Keygeneration
RSAinvolvesapublickeyandaprivatekey 18.Thepublickeycanbeknowntoeveryoneandisusedforencryptingmessages.Messagesencrypted
with the public key can only be decrypted using the private key. The keys for the RSA algorithm are generated the following way. Choose two
distinctprimenumbers pand q.Forsecuritypurposes,theintegers pandq shouldbechosen uniformlyatrandomandshouldbeofsimilar bit
length19,20.PrimeintegerscanbeefficientlyfoundusingaPrimalitytest.Computen=p*q21.nisusedasthemodulusforboththepublicandprivate
keys.Computethetotient:(n)=(p1)*(q1).Chooseanintegeresuchthat1<e<(n),andeand(n)arecoprime.eisreleasedasthepublickey
exponent.Choosingehavingashortadditionchainresultsinmoreefficientencryption.Determined(usingmodulararithmetic)whichsatisfiesthe
congruence relation d*e 1(mod (n)). d is kept as the private key exponent. The public key consists of the modulus n and the public (or
encryption)exponente.Theprivatekeyconsistsofthemodulusnandtheprivate(ordecryption)exponentdwhichmustbekeptsecret.
Encryption
Alicetransmitsherpublickey(n,e)toBobandkeepstheprivatekeysecret.BobthenwishestosendmessageMtoAlice.HefirstturnsMintoan
integer 0<m< n by using an agreedupon reversible protocol known as a padding scheme. He then computes the ciphertext c corresponding to:
cme(modn).Thiscanbedonequicklyusingthemethodofexponentiationbysquaring.BobthentransmitsctoAlice22.
Decryption
Alicecanrecovermfromcbyusingherprivatekeyexponentdbythefollowingcomputation:
mcd(modn).Givenm,shecanrecovertheoriginalmessageMbyreversingthepaddingscheme23.
Theabovedecryptionprocedureworksbecause:
m(me)d(modn)med(modn).Now,sincee*d=1+k*(n),medm1+k*(n)m*(mk)(n)m(modn)
The last congruence directly follows from Euler's theorem 24 when m is relatively prime to n. By using the Chinese remainder theorem it can be
shownthattheequationsholdforallm.Thisshowsthattheoriginalmessageisretrievedascdm(modn).
AutogenerationofkeysforRSAalgorithm
GeneratepTakethecurrenttimeanddateandmergethem.Tooktheexponent(ifany)ofthenumber.Thenumbersoformedmaynotbeprime,so
firstcheckthenumberwhetheritpassestheMillerRabinPrimalityTest.Ifitdoesnt,choosethenextintegerandcheckitpassestheMillerRabin
PrimalityTest.Continuethiswayuntilanumberisfoundwithhighprobability.
GenerateqTakethecurrenttimeanddateandswapthenmergethem.Tooktheexponent(ifany)ofthenumber.Thenumbersoformedmaynotbe
prime,sofirst checkthe numberwhetheritpassestheMillerRabinPrimalityTest. Ifitdoesnt,choose thenextintegerandcheckitpassesthe
MillerRabin PrimalityTest.Continuethisway untila number is foundwithhighprobability. Computen Thevalue ofniscomputed by n=p*q.
ComputeThevalueofiscomputedas=(p1)*(q1).Chooseeeisarandomlychosen70bitnumber,suchthatgcd(e,)=1.ComputedThe
secretkeyexponentdiscalculatedfromtheequation
.
MillerRabinprimalitytest
In modern cryptography, special mathematical tools are used for generation of prime numbers. Among the other probabilistic Primality Tests
MillerRabinisveryefficient12.Provingthisissomewhatdifficult,soturnthequestionupsidedownandconvinceprobabilisticallythatthenumber
isaprime.Ifthetestsucceedsthenitisaprime(withextremelyhighprobability).Ifthetestfails,itiscertainthatthenumberisnotaprime.
Theory
TheMillerRabintestreliesonanequalityorsetofequalitiesthatholdtrueforprimevalues,thencheckswhetherornottheyholdforanumber
thatwewanttotestforprimality.First,alemmaaboutsquarerootsofunityinthefinitefield
,wherepisprimeandp>2.Certainly1and1
alwaysyield1whensquaredmodp;callthesetrivialsquarerootsof1.Therearenonontrivialsquarerootsof1modp(aspecialcaseoftheresult
that, in a field, a polynomial has no more zeroes than its degree). To show this, suppose that x is a nontrivial square root of 1 mod p. Then:
or,
Sincexisnontrivial,xisneither1nor1modp,andthereforebothx1andx+1arecoprime
to p. Hence, neither x1 nor x+1 is divisible by p. But if a prime divides neither of two integers, it cannot divide their product. Therefore:
Thisleadstoacontradiction,fromwhichweconcludethat xcannotbenontrivial.Now,let nbeanoddprime.
Thenn1isevenandwecanwriteitas2sd,wheresanddarepositiveintegers(disodd).Foreach
,either
or,

Mandaletal.
IntJCompEngg,Vol1,Issue1(2010),813
forsome
Toshowthatoneofthesemustbetrue,recallFermatslittletheorem(whichonlyappliesfor
primemoduli):
Bythelemmaabove,ifwekeeptakingsquarerootsofan1,wewillgeteither1or1.Ifweget1thenthe
secondequalityholdsandwearedone.Inthecasewhenwevetakenouteverypowerof2andthesecondequalityneverheld,weareleftwiththe
firstequalitywhichalsomustbeequalto1or1,asittooisasquareroot.However,ifthesecondequalityneverheld,thenitcouldnthaveheldfor
Thus,incasethesecondequalitydoesnthold,thefirstequalitymust.TheMillerRabinprimalitytest
r=0,meaningthat
is based on the contra positive of the above claim. That is, if we can find an a such that
and
for all
thenaisawitnessforthecompositenessofn(sometimesmisleadinglycalledastrongwitness,althoughitisacertainproofofthis
fact).Otherwiseaiscalledastrongliar,andnisastrongprobableprimetobasea.Thetermstrongliarreferstothecasewhereniscompositebut
neverthelesstheequationsholdingastheywouldforaprime.Foreveryoddcompositen,therearemanywitnessesa.However,nosimplewayof
generatingsuchanaisknown.Thesolutionistomakethetestprobabilistic:wechoosenonzero
randomly,andcheckwhetherornot
itisawitnessforthecompositenessofn.Ifniscomposite,mostofthechoicesforawillbewitnesses,andthetestwilldetectnascompositewith
highprobability.Thereis,nevertheless,asmallchancethatweareunluckyandhitanawhichisastrongliarforn.Wemayreducetheprobabilityof
sucherrorbyrepeatingthetestforseveralindependentlychosena.
AlgorithmfortheMillerRabinprobabilisticprimalitytest
MillerRabin(n,t)
INPUT:Anoddintegern>1andapositivesecurityparametert
OUTPUT:theanswerCOMPOSITEorPRIME
Writen1=2srsuchthatrisodd
Repeatfrom1tot
Choosearandomintegerawhichsatisfies1<a<n1
Computey=armodn
Ify>1andy<n1thenDO
j:=1
WHILEj<sandy<n1thenDO
y:=y2modn
ify=1thenreturn(COMPOSITE)
j:=j+1
ify<n1thenreturn(COMPOSITE)
Return(PRIME)
MillerRabinexample
Suppose,ifn=221isprime.Writen1=220as2255,sothats=2andd=55.Selectana<nof174.Proceedtocompute19:

a20dmodn=17455mod221=471,n1

a21dmodn=174110mod221=220=n1.

Since2201modn,either221isprime,or174isastrongliarfor221.Tryanotherrandoma,thistimechoosinga=137:

a20dmodn=13755mod221=1881,n1

a21dmodn=137110mod221=205n1.

Hence137isawitnessforthecompositenessof221,and174wasinfactastrongliar.Notethatthisrevealsnothingaboutthefactorsof221(which
are13and17).
Computingtheoptimalsecurityparameter
Thesecurityparameterisanindicationofprobabilitywithwhichthegivennumberistobetested.Foragivent,theprobabilityoffailure(P(f))of
the MillerRabin teat is given by, P(f) = 1/2t. In the MillerRabin implementation, this security parameter is constant and it is decided before
execution. To solve this problem, in this paper, a dynamic security parameter has been chosen that will depend on the number of digits of the
number to be tested. To fulfill the objective, the security parameter to be so chosen that it will just meet the criteria. To, overcome both the
problems,Inthispaper,asolutionhasbeenfoundout.Fromthepropertyoflogarithm,

Inthiscase,a=2 ,b=2,c=10.
t

So,

Mandaletal.
IntJCompEngg,Vol1,Issue1(2010),813

Now,theabsolutevalueof
denotesonelessthanthenumberofdigitsin2t.Thesecurityparameteriscalculatedassecurityparameter=
absolutevalue of((Number of digitsinthenumber tobetested)/log210).Soitgivestheoptimal valueforthesecurityparameterforthenumber
concerned.
Statement1:ForanynaturalnumberN,thereexistnaturalnumberstandsuchthatN/2t>1/(Fromthepropertyofrationalnumbers).
Proofofoptimality
So,theStatement1holdsalsofor=10.(Hereischosen10as1/10=0.1andalsolog10=1).
N/2t=N*P(f).
Now,
ForanyintegerNthefollowinginequalityholds.

2tN<2t+1(1)
So,combiningstatement1andequation1,
N/2t0.1
or,10*N2t
or,1+logNt*log2
Tobeonthesafeside,reducetheinequalityto
or,1+[logN]t*log2,where[x]denotesthegreatestintegerfunction.
or,(1+[logN])/log2t
Nowtisaninteger.So,
or,[(1+[logN])/log2]t
Hence,securityparameter=[(1+[logN])/log2]istheoptimalsolution.(Proved).
RESULTS
Inthispaper,onestringistakenasplaintextandRSAalgorithmhasbeenusedtoencryptanddecryptthisstring.Thenumberhasbeentakenfrom
thesystemdateandtimeatthetimeofexecutionofprogramwithpower5isshownin6.1.Thetable1&2havebeenfurnishedtofindthetime
requiredforautogenerationofkeysandencryptionanddecryptiontimesfordifferentfileformatswithdifferentsizes.
RSAexample
power=5
p=
309315058695028468222168239956078292846738413418158277889506828396523503256340926860335359031881988267670026761234
09198755897633893
q=
270712262176117703259160128621803171803032779320741673764210924479716365689199488102108680824966797111525524626533
849966489675366599
n=
837353792644697825076590045220296747773673132930456425138035145708391223494817121903828621259550630513808467486012
262006339760723378277930019332095102892257344607416833464523131150938140379902603386194837734027000863604547066559
4415971406737741526227871462539907
=
837353792644697825076590045220296747773673132930456425138035145708391223494817121903828621259550630513808467486012
262006339760723348113553214770040094754562082866316724693861064895187985063741871449323236250668922049382874251059
8477678879435084267062625889539416
e=1070886853465990448477
d=
638832706750512093117726240580111122378970170074328334545293364319549114865024837729766728421543740746152981907764
791654557921091661747587213954437436872155003276194490792767025084867304610957186237579811266418611577985977052465
3052862537890026383483304680824493
Plainttext
ThisisanimplementationofRSAalgorithm.
Encryptedmessage
269435184924485265376204008133395641137590251967542058823414629225086167530101378448299781336259206213035142013952
988327335934573753534548178970856366263459943334413624857701898982463605869795872067868897122475627119745834727469
2959630061273280793749730670312497
343836367479967680657695329494876880793084272059654033456583798936392051207876107719370657886122860929342593954753
9

Mandaletal.
IntJCompEngg,Vol1,Issue1(2010),813
629441796786881638389102871981022145602160157174539348118724265447644104918156118987105302404408134869601665857821
9024880523312359530491931287919121
190087427282778910663966832940897074090643598093444047031976130220011578987021789247940208449229145207272591374208
Table1:TableforTimerequiredforautogenerationofkeys(theprimesaresubjecttochangewithtimeanddate)
Floor(log1
0(p)+1)
27
27
53
79

Power

Prime

1
2
3

105

131

157

183

209

235

261

10

288

11

302

12

125232374571807122009171239
125232374571807122009171239
15683150518908833075605884421370962504647394944816481
196403892372707913339743967112190685734423346210429151829411030
0615655495528007
245961414396740162320506926225091389878417748991952024562070220
733480293052441301153818313380709007360217
308023583935397390429174722646369819686612846589697909646282855
099832662422428676670548348640394736844503526839490652260100000
00027
385745887301013236648073673058639217559901290964569417648303229
239201323081742157142101338297217339944125634381753229951115611
5371991298810278241112064000037
483079573695657581419095964420859817714268524781485047875383179
424498351346541558010703181891495065062871416734111789184615380
969458208795463414035977064116195784996322613821440001247
604973341393522637768113361584972843669924730128859626075359652
306644135259054139329008856693778964852678755394679775358751607
533319864193820253858665730836810697956637669265614771914006854
52045365273600000053
757626691042735275659500751535308369040273344097685725024929381
174682168753106115895631980307981570588472915905663751739638220
924298743428925854259837582916045824176345154202340045845429579
8272284596388231940588322143000000000000000119
948797102716471806207593235515490283646933350556861270678112570
830384955067050834914914463430391439926861744480274208023859692
290936529572504110952494633324891286241517259573974934704065466
696504511008617899863254122935997878077242864121904900000000000
000000137
118820780688756786567184031354724247422646442965965775952605622
888071552750439534452134563691262259136003130368513048904762547
686849773742966089495432057329107905266849648720915031759567478
840771030220020845059457194837348025073675397817650503204827433
673648684006000821050520700000002031
148802940958889251479421375839551108175068304697753304974694585
623541908665991766708518670424602734786819662627295899848263367
044219400519058922628633497124402892162684724799898458083048865
246882997551388838668038318364598984723363396700084556071423515
58541361581886564678941601000000000000000000003133

Time
insec
<1
<1
1
2
6
11
25
50
61

99

133

282

465

991426457742012693814375293900702275673682866966185514581936074435969759901997503391641287449907623740258996972947
0311039869041405055211344654920380
397047084743199926592372591018514677647413335577578129190975629346846959328637817662075132986330324403416523926205
265006405802408586572562313221306204634514378782882688008170910179858370964727092475230246651971817274667546422964
573649249104603964982069894945296
307491511035698008980798193000202063508304626967370311778874326884851086322657568731252781456936221393583173274060
622413240301276279127652268101585556053169574214726548932933716040599007783601321629209720836379143953508276342031
4060355100912229635124489517189349
190087427282778910663966832940897074090643598093444047031976130220011578987021789247940208449229145207272591374208
991426457742012693814375293900702275673682866966185514581936074435969759901997503391641287449907623740258996972947
0311039869041405055211344654920380
397047084743199926592372591018514677647413335577578129190975629346846959328637817662075132986330324403416523926205
265006405802408586572562313221306204634514378782882688008170910179858370964727092475230246651971817274667546422964
573649249104603964982069894945296
307491511035698008980798193000202063508304626967370311778874326884851086322657568731252781456936221393583173274060
622413240301276279127652268101585556053169574214726548932933716040599007783601321629209720836379143953508276342031
4060355100912229635124489517189349
152051969610047457190367386453959223716636151862631164855375907295845626487793774223583822837801210878153982148259
624172085085027503655150724042408900081777708230563138550314187121478218743254415148808489965968156635510702313567
6226198058693641213320364838159842
733489612714834867210680105324833914477307422175615738664385515905487484476980806954577313765290172690629018743188
252807020956592398111538596988530200329308967969768618399542247769304176221870294372738575729099500878182644572408
5710184990775984823438614673105657
307491511035698008980798193000202063508304626967370311778874326884851086322657568731252781456936221393583173274060
622413240301276279127652268101585556053169574214726548932933716040599007783601321629209720836379143953508276342031
4060355100912229635124489517189349
10

Mandaletal.
IntJCompEngg,Vol1,Issue1(2010),813
190087427282778910663966832940897074090643598093444047031976130220011578987021789247940208449229145207272591374208
991426457742012693814375293900702275673682866966185514581936074435969759901997503391641287449907623740258996972947
0311039869041405055211344654920380
304602842941911410105714920785887755910067050342561776607455933292254369581096402860192626723635924124332532504032
531687174367401820066093669102311252240591148521670737850373811251455616544242519815625174960643052722289521288852
7383227216833727778346071305127011
790755158853164229755010038041956451995939110909853884797514967087772792821980823913239064256273264014885521440438
507777122387937105434780470374946367388842281690123806688627084207803348989810755415309061519764549570711873713981
8828599749530710952583578306531648
484873824961187265298694589124260064596423657901252837394689835941709423057943002051144128622339995533533215183245
600905198725005140885962324253984748587400561143035269764216677055132109706943709023609729822356386731987262304114
1601501888122095377502889447060312
620292294123328918894505398492271819574016638372627848090429238071235602370167120671908814440689497157069515493484
277921843396270282722820342288845361979108396207172603670553492747484346008990234350139370110142911881638453949570
9509691264357501096410618297206347
304602842941911410105714920785887755910067050342561776607455933292254369581096402860192626723635924124332532504032
531687174367401820066093669102311252240591148521670737850373811251455616544242519815625174960643052722289521288852
7383227216833727778346071305127011
620292294123328918894505398492271819574016638372627848090429238071235602370167120671908814440689497157069515493484
277921843396270282722820342288845361979108396207172603670553492747484346008990234350139370110142911881638453949570
9509691264357501096410618297206347
733489612714834867210680105324833914477307422175615738664385515905487484476980806954577313765290172690629018743188
252807020956592398111538596988530200329308967969768618399542247769304176221870294372738575729099500878182644572408
5710184990775984823438614673105657
800493172066103355376986105658244130007339559697517368351196761016750146439443441185172377623768751835288404898529
759766061912507918193221069862109347517572747725169905397469769575768631782624876676778853478281759677147023418246
4305625064054076503680135149079489
152051969610047457190367386453959223716636151862631164855375907295845626487793774223583822837801210878153982148259
624172085085027503655150724042408900081777708230563138550314187121478218743254415148808489965968156635510702313567
6226198058693641213320364838159842
800493172066103355376986105658244130007339559697517368351196761016750146439443441185172377623768751835288404898529
759766061912507918193221069862109347517572747725169905397469769575768631782624876676778853478281759677147023418246
4305625064054076503680135149079489
190087427282778910663966832940897074090643598093444047031976130220011578987021789247940208449229145207272591374208
991426457742012693814375293900702275673682866966185514581936074435969759901997503391641287449907623740258996972947
0311039869041405055211344654920380
345189323736110784325921877016940011668177580360803467529833143771268620754248906800976000878797054534313842009715
141577037225145603127535280660114218489789554328512484658757954219596270838598918035677446340913410343195952581615
5376238560409848966062267006695349
733489612714834867210680105324833914477307422175615738664385515905487484476980806954577313765290172690629018743188
252807020956592398111538596988530200329308967969768618399542247769304176221870294372738575729099500878182644572408
5710184990775984823438614673105657
307491511035698008980798193000202063508304626967370311778874326884851086322657568731252781456936221393583173274060
622413240301276279127652268101585556053169574214726548932933716040599007783601321629209720836379143953508276342031
4060355100912229635124489517189349
345189323736110784325921877016940011668177580360803467529833143771268620754248906800976000878797054534313842009715
141577037225145603127535280660114218489789554328512484658757954219596270838598918035677446340913410343195952581615
5376238560409848966062267006695349
109284575320856521859136111251564255608457810534890920373258470017987856210640296159385005280544294563840824099264
533509535936464313663571453062696385096373483000441157100502267773397136220406754312958473158568211593895256497532
3262032358252348436984204680583125
307491511035698008980798193000202063508304626967370311778874326884851086322657568731252781456936221393583173274060
622413240301276279127652268101585556053169574214726548932933716040599007783601321629209720836379143953508276342031
4060355100912229635124489517189349
831102478638905689039141498067240581911267911190708035820650980652386011119443850910988406277891134071442089924822
810352409319682924982642519447936493675919070401820794686278056823930772386413275715808255245448602995412525464515
0669179518764917099321108732484369
197256809333077546975754716262499124019701142604246502536800103490831034015163279557315923940429868980301901335062
545271121751927683672146381919099667055564442020687202201645347960200144210489730815787405031636608706089009874559
7805258819186006870838000240956514
759567973162887006773421348353931806966788268154538199891412753160425913134829997353304388244963354997894416297331
557518097847679379480465352498694838515714402404040596188506354371477428483610829036611142061958086078633198266841
4958243758708986565775395446579518
307491511035698008980798193000202063508304626967370311778874326884851086322657568731252781456936221393583173274060
622413240301276279127652268101585556053169574214726548932933716040599007783601321629209720836379143953508276342031
4060355100912229635124489517189349
152051969610047457190367386453959223716636151862631164855375907295845626487793774223583822837801210878153982148259
624172085085027503655150724042408900081777708230563138550314187121478218743254415148808489965968156635510702313567
6226198058693641213320364838159842
484873824961187265298694589124260064596423657901252837394689835941709423057943002051144128622339995533533215183245
600905198725005140885962324253984748587400561143035269764216677055132109706943709023609729822356386731987262304114
1601501888122095377502889447060312
572627398173638595233854183907411759809792684946423443754074147917501140350150841631302867298265452977201929176969
890866705972079759992172578036730111009996321126005349200677396900373215897954106463292187483787322994075808896772
11

Mandaletal.
IntJCompEngg,Vol1,Issue1(2010),813
9894379390375497465783846255160894
345189323736110784325921877016940011668177580360803467529833143771268620754248906800976000878797054534313842009715
141577037225145603127535280660114218489789554328512484658757954219596270838598918035677446340913410343195952581615
5376238560409848966062267006695349
317651896492284125266992534152037064768410616118024487331443382617440439944964888952287399092538882536069689141153
124444241478135380376779979651977215622698597890343756779599204448533710474267433821093283723784409281279972161493
8913056407724521135284493006955197
190087427282778910663966832940897074090643598093444047031976130220011578987021789247940208449229145207272591374208
991426457742012693814375293900702275673682866966185514581936074435969759901997503391641287449907623740258996972947
0311039869041405055211344654920380
800493172066103355376986105658244130007339559697517368351196761016750146439443441185172377623768751835288404898529
759766061912507918193221069862109347517572747725169905397469769575768631782624876676778853478281759677147023418246
4305625064054076503680135149079489
343836367479967680657695329494876880793084272059654033456583798936392051207876107719370657886122860929342593954753
629441796786881638389102871981022145602160157174539348118724265447644104918156118987105302404408134869601665857821
9024880523312359530491931287919121
304602842941911410105714920785887755910067050342561776607455933292254369581096402860192626723635924124332532504032
531687174367401820066093669102311252240591148521670737850373811251455616544242519815625174960643052722289521288852
7383227216833727778346071305127011
164412621524537238101200179463864518384708192360060235967300026163188464430180761886069428169694263849154603388570
883034049951898847117385608196409585591771871945178160843245584081537459825405982281225770067794360755110617232128
5252618632392791214407536043806440
Decryptedmessage
ThisisanimplementationofRSAalgorithm.
Timecalculation
Timerequiredforkeygeneration,encryptionanddecryptionofRSAalgorithmusingMillerRabinprimalitytestwithoptimalsecurityparameteris
showninthefollowingtables.
Table2:Timetoencryptanddecryptdifferenttypesoffiles
Sizeoffile

Typeoffile

1KB
10KB
14.5KB
44.1KB
100KB
100KB
121KB
427KB
1MB
1MB
47.7MB

txt
txt
gif
mp3
doc
txt
pdf
jpg
doc
txt
VOB

Timetoencrypt
insec
2
12
18
51
97
123
150
590
1054
1225
6325

Timetodecrypt
insec
1
6
8
22
42
54
65
226
450
595
2787

CONCLUSION
VariousworkshavebeendoneforhandlinglargeintegersincontexttoRSA 25,26.However,generatingkeyswiththehelpofsystemtimeanddate
andalsoprovidingthesamelevelofsecurityisimplementedhere.ThisRSAimplementationcanencryptanddecryptanytypeofdigitalfiles.The
useofMillerRabinalgorithmacceleratestheprocessofgeneratingthekeys.Theprocessherehasaprobabilityoffailureof1outof2t.Thiserror
hasbeeneliminatedbyusingtheoptimalsecurityparameter.Howevertherangeofintegersforacompilerisfixed.Sointhispaperthelimitationis
for 1000000000 digit number. The MillerRabin algorithm works for beyond this range, but then the highest security parameter could not be
increased. To reduce the probability of failure, the time taken to generate the keys (Table 1) will increase. To check further large primes
deterministicallytheAKSalgorithmshouldbetriedinfuture.
REFERENCES
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

Mandal N. Satyendra, Banerjee Kumarjit, Maiti Biswajit, Palchaudhury J. , Modified Trail division for Implementation of RSA Algorithm with
LargeIntegers,Int.J.AdvancedNetworkingandApplicationsVolume:01,Issue:04,Pages:210216(2009).
AlfredJMenezes,PaulC.vanOorschot,andScottA.Vanstone,Handbookofappliedcryptography,CRCPress,1996.
BonehDan,TwentyYearsofAttacksontheRSACryptosystem,NoticesoftheAmericanMathematicalSociety(AMS),Vol.46,No.2,pp.203213,
1999.
Ron L. Rivest, Adi Shamir, and Len Adleman, A method for obtaining digitalSignatures and publickey cryptosystems, Communications of the
ACM21(1978),120126.
Fraleigh,John,AFirstCourseinAbstractAlgebra,PearsonEducation,Inc.2003
Koblitz,Neal.GraduateTextsinMathematics:ACourseinNumberTheoryandCryptography.2ndEdition.SpringeVerlag.NewYork:1994.
AlanBaker.AConciseIntroductiontotheTheoryofNumbers.CambridgeUniversityPress,1984.
BonehandDurfee,CryptanalysisofRSAwithprivatekeydlessthann0.292,IEEETIT:IEEETransactionsonInformationTheory46(2000).
C.Pomerance,J.L.SelfridgeandWagstaff,Jr.,S.S.,Thepseudoprimesto25109,Math.Comp.,35:151(1980)10031026.
GerhardJaeschke,Onstrongpseudoprimestoseveralbases,MathematicsofComputation61(1993),no.204,pp.915926.
ZhenxiangZhangandMinTang,Findingstrongpseudoprimestoseveralbases.II,MathematicsofComputation72(2003),pp.20852097
GaryL.Miller,RiemannsHypothesisandTestsforPrimality,JournalofComputerandSystemSciences13(1976),no.3,pp.300317.
MichaelO.Rabin,Probabilisticalgorithmfortestingprimality,JournalofNumberTheory12(1980),no.1,pp.128138.

12

Mandaletal.
IntJCompEngg,Vol1,Issue1(2010),813
14. Ren Schoof, Four primality testing algorithms, to appear in: Surveys in algorithmic number theory, Cambridge University Press.PDF ISBN
0521808545Damgrd,P.Landrock,andC.Pomerance(1993),Averagecaseerrorestimatesforthestrongprobableprimetest,Math.Comp.61
(203)p.177194.
15. EricBach,Explicitboundsforprimalitytestingandrelatedproblems,MathematicsofComputation55(1990),no.191,pp.355380.
16. Christina McIntosh, Finding Prime Numbers: Miller Rabin and beyond, Furman University Electronic Journal of Undergraduate Mathematics
Volume12,14,2007
17. DouglasR.Stinson,Cryptography,theoryandpractice,CRCPress,1995.
18. M.Wiener,Cryptanalysisofshortrsasecretexponents,IEEETransactionsonInformationTheory36(1990),553558.
19. G.H.Hardy,E.M.WrightAnIntroductiontotheTheoryofNumbersFifthEditionpp63.
20. TheOnLineEncyclopediaofIntegerSequences,http//www.research.att.com/unjas/sequences.
21. W.R.Alford,A.Granville,andC.Pomerance, Onthedifficultyoffindingreliablewitnesses,in:AlgorithmicNumberTheory,FirstInternational
Symposium,Proceedings(L.M.Adleman,M.D.Huang,eds.),LNCS877,SpringerVerlag,1994,pp.116.
22. GuichengShen,BingwuLiu,XuefengZheng,ResearchonFastImplementationofRSAwithJava,Nanchang,P.R.China,May2224,2009,pp.186
189
23. Koblitz,Neal.GraduateTextsinMathematics:ACourseinNumberTheoryandCryptography.2ndEdition.SpringeVerlag.NewYork:1994.
24. Mollin,Richard,RSAandPublicKeyCryptography,Chapman&Hall,CRC,2003.
25. Mollin,Richard,AnIntroductiontoCryptography,Chapman&Hall,CRC,2000.
26. DavidM.Burton,ElementaryNumberTheory.SecondEditionpp114115.

13

Vous aimerez peut-être aussi