Kryptografie veřejného klíče
Úvod
Thisisjustoneaspectofthecurrentcryptographytheme.Theverificationofthetrueidentityofthesenderandreceiveroftheinformation,thenon-repudiationofthesent/receivedinformationafterthefact,andtheprotectionoftheintegrityofthedataareotheraspectsofmoderncryptography.
Thepublickeycryptosystemhasprovidedexcellentanswerstothesetwoissues,andmanynewideasandsolutionsarecontinuingtobeproduced.Inthepublickeysystem,theencryptionkeyisdifferentfromthedecryptionkey.Peoplemaketheencryptionkeypublicandanyonecanuseit;andthedecryptionkeyisonlyknowntothedecryptor.Amongallpublickeycryptosystemssofar,theRSAsystemisthemostfamousandwidelyusedone.
Vývojový proces
In1976,apublickeycryptosystemwasproposed,theprincipleofwhichistoseparatetheencryptionkeyandthedecryptionkey.Inthisway,aspecificusercanpublicizetheencryptionkeyandalgorithmhedesigned,andonlykeepthedecryptionkeysecret.Anyonewhousesthisencryptionkeyandalgorithmtosendencryptedinformationtotheusercanrestoreit.Theadvantageofpublickeycryptographyisthatitdoesnotneedtopassthekeythroughasecurechannel,whichgreatlysimplifieskeymanagement.Itsalgorithmissometimescalledpublickeyalgorithmorpublickeyalgorithmforshort.
In1978,aspecificimplementationplanforpublickeycryptography,theRSAplan,wasproposed.
TheDSAalgorithmproposedin1991isalsoapublickeyalgorithm,whichhasgreaterapplicationadvantagesindigitalsignatures.
Koncepty
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.
Osvědčení
TheusergroupoftheInternetisbynomeansasmallgroupofpeoplewhotrusteachother.Inthisusergroup,fromalegalpointofview,userscannoteasilytrusteachother.Therefore,thepublickeyencryptionsystemhasadoptedanotherapproach,linkingthepublickeywiththenameoftheownerofthepublickey,andthenaskacredible,fairandauthoritativeorganizationthateveryonecantrusttoconfirm,andaddthesignatureofthisauthority.Thisformsthecertificate.
Becausethecertificateissignedbyanauthority,everyonebelievesthatthecontentonthecertificateistrustworthy;andbecausethecertificatehasidentityinformationsuchastheowner’sname,otherscaneasilyknowthepublickeyWhoistheowner.
CA
Theauthoritymentionedaboveistheelectronicvisaauthority,orCA.CA(OsvědčeníAuthority)alsohasacertificate(containingapublickey),ofcourse,italsohasitsownprivatekey,soithastheabilitytosign.OnlinepublicuserstrusttheCA(OsvědčeníAuthority)byverifyingthesignatureoftheCA(OsvědčeníAuthority).Anyoneshouldbeabletoobtainthecertificate(includingthepublickey)oftheCA(OsvědčeníAuthority)toverifythecertificateissuedbyit.
Iftheuserwantstogetacertificateofhisown,heshouldfirstapplytotheCA(OsvědčeníAuthority).AftertheCA(OsvědčeníAuthority)determinestheidentityoftheapplicant,itassignshimapublickey,andtheCA(OsvědčeníAuthority)bindsthepublickeytotheapplicant’sidentityinformationandsignsittoformacertificateTothatuser(applicant).
Ifauserwantstoverifytheauthenticityofanothercertificate,hewillusetheCA’spublickeytoverifythesignatureonthatcertificate(asmentionedabove,theCAsignatureisactuallypassedbytheCA(OsvědčeníAuthority)Informationencryptedbytheprivatekey,theprocessofsignatureverificationisaccompaniedbytheprocessofdecryptingusingtheCA(OsvědčeníAuthority)publickey).Oncetheverificationispassed,thecertificateisconsideredvalid.
Inadditiontoissuingcertificates,CA(OsvědčeníAuthority)hasanotherimportantroleinthemanagementofcertificatesandkeys.
Itcanbeseenthatthecertificateistheuser’selectronicpersonalIDcardontheInternet,whichhasthesamefunctionasthepersonalIDcardusedindailylife.CA(OsvědčeníAuthority)isequivalenttotheonlinepublicsecuritybureau,whichspecializesinissuingandverifyingIDcards.
Algoritmus
Úvod
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.
Cíle informační bezpečnosti
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.
generovat
1.Choosetwolargeprimenumbers,pandq,andcalculaten=qp,whereniscalledthemodulusoftheRSAalgorithm.pandqmustbekeptsecret.Generally,pandqarerequiredtobesecureprimenumbers,andthelengthofnisgreaterthan1024bits.ThisismainlybecausethesecurityoftheRSAalgorithmreliesontheproblemoffactoringlargenumbers.
2.VypočítejteEulerovočíslo
φ(n)=(p-1)(q-1)
φ(n)isdefinedasThenumberofnumbersthatdonotexceednandarerelativelyprimeton.
3.Poté náhodně vyberte šifrovací klíč a vyberte číslo, které je relativně prvočíslo φ(n)z[0,φ(n)-1]jako index šifrování veřejnosti.
4.Finally,theEuclidalgorithmisusedtocalculatethedecryptionkeyd,whichsatisfiesde≡1(modφ(n)).Amongthem,nanddshouldalsoberelativelyprime.Thenumberseandnarepublickeys,anddistheprivatekey.Thetwoprimenumberspandqarenolongerneededandshouldbediscardedwithoutlettinganyoneknow.
5. Získejte požadovaný veřejný a tajný klíč:
Publickey(ieencryptionkey)PK=(e,n)
Secretkey(decryptionkey)SK=(d,n)
Šifrování a dešifrování
1.Whenencryptinginformationm(binaryrepresentation),firstdividemintoequal-lengthdataBlockm1,m2,...,mi,blocklengths,where2^s<=n,sisaslargeaspossible.
2.Odpovídající šifrový text:ci≡mi^e(modn)(a)
3.Při dešifrování vypočítejte takto:mi≡ci^d(modn)(b)RSAlze použít pro digitální podpisy, schéma použije(a)podpisa(b)ověření.