Криптография с публичен ключ
Въведение
Thisisjustoneaspectofthecurrentcryptographytheme.Theverificationofthetrueidentityofthesenderandreceiveroftheinformation,thenon-repudiationofthesent/receivedinformationafterthefact,andtheprotectionoftheintegrityofthedataareotheraspectsofmoderncryptography.
Thepublickeycryptosystemhasprovidedexcellentanswerstothesetwoissues,andmanynewideasandsolutionsarecontinuingtobeproduced.Inthepublickeysystem,theencryptionkeyisdifferentfromthedecryptionkey.Peoplemaketheencryptionkeypublicandanyonecanuseit;andthedecryptionkeyisonlyknowntothedecryptor.Amongallpublickeycryptosystemssofar,theRSAsystemisthemostfamousandwidelyusedone.
Процес на развитие
In1976,apublickeycryptosystemwasproposed,theprincipleofwhichistoseparatetheencryptionkeyandthedecryptionkey.Inthisway,aspecificusercanpublicizetheencryptionkeyandalgorithmhedesigned,andonlykeepthedecryptionkeysecret.Anyonewhousesthisencryptionkeyandalgorithmtosendencryptedinformationtotheusercanrestoreit.Theadvantageofpublickeycryptographyisthatitdoesnotneedtopassthekeythroughasecurechannel,whichgreatlysimplifieskeymanagement.Itsalgorithmissometimescalledpublickeyalgorithmorpublickeyalgorithmforshort.
In1978,aspecificimplementationplanforpublickeycryptography,theRSAplan,wasproposed.
TheDSAalgorithmproposedin1991isalsoapublickeyalgorithm,whichhasgreaterapplicationadvantagesindigitalsignatures.
Концепции
Somebasicconceptsandstructuralcomponentsinthepublickeyarchitecture.
KeypairInasecuritysystembasedonapublickeysystem,keysaregeneratedinpairs,andeachpairofkeysiscomposedofapublickeyandaprivatekey.Inpracticalapplications,theprivatekeyiskeptbytheowner,whilethepublickeyneedstobepublishedtothepublic.Inordertomakethebusinessbasedonthepublickeysystem(suchase-commerce,etc.)widelyused,afundamentalandkeyissueisthedistributionandmanagementofpublickeys.
Thepublickeyitselfisnotmarked,andtheownerofthepublickeycannotbedistinguishedfromthepublickeyalone.
Inaverysmallarea,suchasasmallgroupoftwopeoplelikeAandB,theytrusteachother,exchangepublickeys,andcommunicateontheInternetwithoutanyproblems.Ifthisgroupisalittlelarger,itmaynotbeaproblemtotrusteachother,butfromalegalperspective,suchtrustisalsoproblematic.Ifitisbigger,thetrustproblembecomesabigproblem.
Сертификат
TheusergroupoftheInternetisbynomeansasmallgroupofpeoplewhotrusteachother.Inthisusergroup,fromalegalpointofview,userscannoteasilytrusteachother.Therefore,thepublickeyencryptionsystemhasadoptedanotherapproach,linkingthepublickeywiththenameoftheownerofthepublickey,andthenaskacredible,fairandauthoritativeorganizationthateveryonecantrusttoconfirm,andaddthesignatureofthisauthority.Thisformsthecertificate.
Becausethecertificateissignedbyanauthority,everyonebelievesthatthecontentonthecertificateistrustworthy;andbecausethecertificatehasidentityinformationsuchastheowner’sname,otherscaneasilyknowthepublickeyWhoistheowner.
CA
Theauthoritymentionedaboveistheelectronicvisaauthority,orCA.CA(СертификатAuthority)alsohasacertificate(containingapublickey),ofcourse,italsohasitsownprivatekey,soithastheabilitytosign.OnlinepublicuserstrusttheCA(СертификатAuthority)byverifyingthesignatureoftheCA(СертификатAuthority).Anyoneshouldbeabletoobtainthecertificate(includingthepublickey)oftheCA(СертификатAuthority)toverifythecertificateissuedbyit.
Iftheuserwantstogetacertificateofhisown,heshouldfirstapplytotheCA(СертификатAuthority).AftertheCA(СертификатAuthority)determinestheidentityoftheapplicant,itassignshimapublickey,andtheCA(СертификатAuthority)bindsthepublickeytotheapplicant’sidentityinformationandsignsittoformacertificateTothatuser(applicant).
Ifauserwantstoverifytheauthenticityofanothercertificate,hewillusetheCA’spublickeytoverifythesignatureonthatcertificate(asmentionedabove,theCAsignatureisactuallypassedbytheCA(СертификатAuthority)Informationencryptedbytheprivatekey,theprocessofsignatureverificationisaccompaniedbytheprocessofdecryptingusingtheCA(СертификатAuthority)publickey).Oncetheverificationispassed,thecertificateisconsideredvalid.
Inadditiontoissuingcertificates,CA(СертификатAuthority)hasanotherimportantroleinthemanagementofcertificatesandkeys.
Itcanbeseenthatthecertificateistheuser’selectronicpersonalIDcardontheInternet,whichhasthesamefunctionasthepersonalIDcardusedindailylife.CA(СертификатAuthority)isequivalenttotheonlinepublicsecuritybureau,whichspecializesinissuingandverifyingIDcards.
Алгоритъм
Въведение
ThepublickeyalgorithmwasdevelopedbyDiffieandHellmanatStanfordUniversityin1976.Thetwofirstinventedit(thesis"NewDirectioninCryptography").ButcurrentlythemostpopularRSAwasjointlydevelopedbyMITprofessorsRonaldL.Rivest,AdiShamirandLeonardM.Adlemanin1977,andwascomposedofthefirstlettersofthenamesofthreemathematicians.
Theideaofthepublickeycryptosystemproposedin1976isdifferentfromthetraditionalsymmetrickeycryptosystem.Itrequireskeystoappearinpairs,oneistheencryptionkey(e),andtheotheristhedecryptionkey.(d),anditisimpossibletodeduceonefromtheother.Since1976,avarietyofpublic-keycryptographicalgorithmshavebeenproposed,manyofwhichareinsecure,someareconsideredsecureandmanyarenotpractical.Theyareeitherthekeyistoolarge,ortheciphertextisveryextended.serious.Thesecurityfoundationofmostcryptographicalgorithmsisbasedonsomemathematicalproblems,whichexpertsbelievecannotbesolvedinashortperiodoftime.Becausesomeproblems(suchasfactorizationproblems)havebeenthousandsofyearsold.
Publickeyencryptionalgorithm,alsocalledasymmetrickeyalgorithm,usestwopairsofkeys:apublickeyandaprivatekey.Theusermustensurethesecurityoftheprivatekey;thepublickeycanbereleased.Publickeyandprivatekeyarecloselyrelated.Informationencryptedwithpublickeycanonlybedecryptedwithprivatekey,andviceversa.Sincethepublickeyalgorithmdoesnotrequireanonlinekeyserverandthekeydistributionprotocolissimple,thekeymanagementisgreatlysimplified.Inadditiontoencryptionfunctions,publickeysystemscanalsoprovidedigitalsignatures.
RSA
ThemostwidelyusedpublickeyencryptionalgorithmisRSA.RSAusestwokeys,apublickeyandaprivatekey.Ifoneisusedforencryption,theothercanbeusedfordecryption.Thekeylengthisvariablefrom40to2048bits.Theplaintextisalsodividedintoblocksduringencryption.Theblocksizeisvariablebutcannotexceedthelengthofthekey.TheRSAalgorithmdivideseachblockofplaintextConvertedintoaciphertextblockwiththesamelengthasthekey.Thelongerthekey,thebettertheencryptioneffect,butthecostofencryptionanddecryptionisalsogreater,sotheremustbeacompromisebetweensecurityandperformance.Generally,64-bitismoreappropriate.Awell-knownapplicationofRSAisSSL.IntheUnitedStatesandCanada,the128-bitRSAalgorithmisusedforSSL.Duetoexportrestrictions,the40-bitversioniscommonlyusedinotherregions(includingChina).
TheoriginalconceptandgoalofRSAalgorithmdevelopmentistomaketheInternetsafeandreliable,aimingtosolvetheproblemoftheuseofopenchanneltransmissionanddistributionofthesecretkeyoftheDESalgorithm.Theactualresultsnotonlysolvethisproblemwell;RSAcanalsobeusedtocompletethedigitalsignatureofthemessagetoresistthedenialanddenialofthemessage;atthesametime,thedigitalsignaturecanbeusedtoeasilydetecttheillegaltamperingofthemessagebytheattacker.Toprotecttheintegrityofdatainformation.
Цели на информационната сигурност
Generally,thegoalsofinformationsecuritycanbesummarizedassolvingthefollowingproblemsofinformation:
Confidentialityensuresthatinformationisnotleakedtounauthorizedpersons.Anyoneauthorized.
Integritypreventsinformationfrombeingtamperedwithbyunauthorizedpersons.
Availabilityguaranteesthatinformationandinformationsystemsareindeedusedbyauthorizedpersons.
Controllability(Controllability)implementssecuritymonitoringofinformationandinformationsystemstopreventillegaluseofinformationandinformationsystems.
Passwordisakindoftransformation.Theuseofpasswordtransformationtoprotectinformationsecretsisthemostprimitiveabilityofpasswords.However,withthedevelopmentofinformationandinformationtechnology,moderncryptographyisnotonlyusedtosolvetheproblemofinformationConfidentiality,butalsousedtosolvetheintegrity,availabilityandcontrollabilityofinformation.Itcanbesaidthatpasswordisthemosteffectivemeanstosolveinformationsecurity,andpasswordtechnologyisthecoretechnologytosolveinformationsecurity.
Theadvantageofpublickeysisthatyoumaynotknowanentity,butaslongasyourserverbelievesthattheentity’sCAisreliable,youcancommunicatesecurely.ThisisexactlywhatWebcommerceis.Requiredforsuchabusiness.Forexample,creditcardshopping.TheservicepartycanauthorizeitsownresourcesaccordingtothereliabilityoftheissuingorganizationoftheclientCA.Atpresent,thereisnoCAthatcanbewidelytrustedathomeandabroad.TheproductsofAmericanNatescapeCompanysupportpublickey,butNatescapeCompanyisregardedastheCA.ItisunthinkableinChinathataforeigncompanyactsasaCA.
Theprocessingspeedofthepublickeyschemeisslowerthanthatofthesecretkeyscheme.Therefore,thepublickeyandtheprivatekeytechnologyareusuallycombinedtoachievethebestperformance.Thatis,thepublickeytechnologyisusedtotransfertheprivatekeybetweenthecommunicationparties,andtheprivatekeyisusedtoencryptanddecrypttheactualdatatransmitted.Inaddition,publickeyencryptionisalsousedtoencryptprivatekeys.
Amongthesesafeandpracticalalgorithms,somearesuitableforkeydistribution,somecanbeusedasencryptionalgorithms,andsomeareonlyusedfordigitalsignatures.Mostalgorithmsrequirelargenumberoperations,sotheimplementationspeedisveryslowandcannotbeusedforfastdataencryption.Thefollowingwillintroduceatypicalpublickeycryptographicalgorithm-RSA.
RSAalgorithmcompletesthedigitalsignatureofthemessageverywelltoresistthedenialanddenialofthedata;itiseasiertofindtheillegaltamperingofthemessagebytheattackerbyusingthedigitalsignaturetoprotecttheintegrityofthedatainformation.Sofar,manyencryptiontechnologiesuseRSAalgorithm,suchasPGP(PrettyGoodPrivacy)encryptionsystem,whichisatoolsoftwarethatcanbeusedtoencrypt,decryptordigitallysignfilesafterregisteringwiththecertificationcenter.PGPusesRSAalgorithm.ItcanbeseenthatRSAhasverygoodapplications.
Генерирай
1.Choosetwolargeprimenumbers,pandq,andcalculaten=qp,whereniscalledthemodulusoftheRSAalgorithm.pandqmustbekeptsecret.Generally,pandqarerequiredtobesecureprimenumbers,andthelengthofnisgreaterthan1024bits.ThisismainlybecausethesecurityoftheRSAalgorithmreliesontheproblemoffactoringlargenumbers.
2. Изчислете числото на Ойлер от n
φ(n)=(p-1)(q-1)
φ(n)isdefinedasThenumberofnumbersthatdonotexceednandarerelativelyprimeton.
3. След това произволно изберете ключа за криптиране и изберете число, което е сравнително просто до φ(n) от [0,φ(n)-1]като публичен индекс на криптиране.
4.Finally,theEuclidalgorithmisusedtocalculatethedecryptionkeyd,whichsatisfiesde≡1(modφ(n)).Amongthem,nanddshouldalsoberelativelyprime.Thenumberseandnarepublickeys,anddistheprivatekey.Thetwoprimenumberspandqarenolongerneededandshouldbediscardedwithoutlettinganyoneknow.
5. Вземете необходимия публичен и таен ключ:
Publickey(ieencryptionkey)PK=(e,n)
Secretkey(decryptionkey)SK=(d,n)
Шифроване и декриптиране
1.Whenencryptinginformationm(binaryrepresentation),firstdividemintoequal-lengthdataBlockm1,m2,...,mi,blocklengths,where2^s<=n,sisaslargeaspossible.
2. Съответният шифъртекст е: ci≡mi^e(modn)(a)
3. Изчислете по следния начин при декриптиране: mi≡ci^d(modn)(b)RSAможе да се използва за цифрови подписи,схематаизползва(a)подпис и(b)проверка.