authenticated encryption - cosic · authenticated encryption (ae) security goals: confidentiality...

60
Authenticated Encryption Kenny Paterson Information Security Group @kennyog ; www.isg.rhul.ac.uk/~kp

Upload: others

Post on 28-Jun-2020

25 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

AuthenticatedEncryption

KennyPaterson

InformationSecurityGroup

@kennyog;www.isg.rhul.ac.uk/~kp

Page 2: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

MotivationforAuthenticatedEncryption

Page 3: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

3

AuthenticatedEncryption(AE)

Securitygoals:

ConfidentialityandintegrityofmessagesexchangedbetweenAliceandBob.

Adversarialcapabilities:

Adversarycanarbitrarilydelete,reorder,modify,etc,bitsonthewire.

Adversarycanmountchosenplaintextandchosenciphertextsattacks–formalisedviaencryptionanddecryptionoracles.

Toolswehave:

Encryption(e.g.blockcipherinCBCmode,CTRmode,streamcipher)andMACalgorithms(e.g.HMAC,CBC-MAC).

m1

m2

Page 4: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

4

FormalisingSymmetricEncryption

Asymmetricencryptionschemeconsistsofatripleofalgorithms:(KGen,Enc,Dec).

KGen:keygeneration,selectsakeyKuniformlyatrandomfrom{0,1}k.

Enc:encryption,takesasinputkeyK,plaintextm∈{0,1}∗andproducesoutput c∈{0,1}∗.

Dec:decryption,takesasinputkeyK,ciphertextC∈{0,1}∗andproducesoutput m∈{0,1}∗oranerrormessage,denoted┴.

Correctness:werequirethatforallkeysK,andforallplaintextsm,

DecK(EncK(m))=m.

Notes:

•  Encmayberandomised(cf.CBCmode,CTRmode).

•  Inreality,therewillbeamaximumplaintextlengththatcanbeencryptedbyagivenscheme.

•  Nonce-basedandstatefulformalismstofollowlater.

Page 5: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

5

AuthenticatedEncryption–InformalDefinition

AsymmetricencryptionschemeissaidtoofferAuthenticatedEncryptionsecurityif:

Achosenplaintextattacker(i.e.anattackerwithaccesstoanencryptionoracle)canlearnnothingaboutplaintextsfromciphertextsexcepttheirlengths.

AND

Anattackerwithaccesstoanencryptionoraclecannotforgeanynewciphertexts.

•  Whatdoesitmean“tolearnnothingaboutplaintextsfromciphertexts”?

•  Howdoweformalise“cannotforgeanynewciphertexts”?

•  Whyisthatpropertyimportantanyway?

Weusesecuritygames,liketheoneintroducedpreviouslyforMACunforgeability.

Page 6: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

6

IND-CPAsecurity

•  TheadversaryhasrepeatedaccesstoLeft-or-Right(LoR)encryptionoracle.

•  Ineachquery,theadversarysubmitspairsofequallengthplaintexts(m0,m1)totheoracle.

•  Wecanhavem0=m1,sowegetanencryptionoracle“forfree”.

•  Theadversarygetsbackc,anencryptionofmb,wherebisafixedbutrandombit.

•  Afterallqueriesaremade,theadversaryoutputsitsestimateb’forbitb.

•  Theadversarywinsifitdecidescorrectly.

IND=Indistinguishable

CPA=ChosenPlaintextAttack

Page 7: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

7

IND-CPAsecurityinapicture

Adversary Challenger

b←{0,1}

(m0,m1)

c=EncK(mb)c

b’Adversarywinsifb=b’

K←KGen

Page 8: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

8

IND-CPAsecurity

Theadversary’sadvantageintheIND-CPAsecuritygameisdefinedtobe:

|Pr(b=b’)-1/2|.

•  Wehave“-1/2”herebecauseadumbadversarycanalwaysguess.

•  AschemeSEissaidtobeIND-CPAsecureiftheadvantageis“small”foranyadversaryusing“reasonable”resources.

•  Conceptsof“small”and“reasonable”canbeformalised,butarebeyondthescopeofthistalk.

•  ItcanbeprovedthatschemeslikeCBC-modeandCTR-modemeetthissecuritydefinitionifusedproperlyandiftheyarebuiltusingagoodblockcipher.

Page 9: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

9

Motivatingstrongersecurity

InCBCandCTRmodes,anactiveadversarycanmanipulateciphertextsandlearninformationfromhowthesearedecrypted.

•  ForCTRmode,bitflippinginplaintextistrivialbyperformingbitflippingintheciphertext.

•  ModifyctocXORΔtochangetheunderlyingplaintextfromptopXORΔ.

•  CBCmode:cutandpasteattacks,paddingoracleattacks.

•  Orcreatecompletelynewciphertextsfromscratch?

•  ArandomstringofbitsoftherightlengthisavalidciphertextforsomeplaintextforbothCBCandCTRmodes!

Page 10: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

10

Motivatingstrongersecurity

•  ThesekindsofattackdonotbreakIND-CPAsecurity,butareclearlyundesirableifwewanttobuildsecurechannels.

•  Amodifiedplaintextmayresultinwrongmessagebeingdeliveredtoanapplication,orunpredictablebehaviouratthereceivingapplication.

•  Wereallywantsomekindofnon-malleableencryption,guaranteeingintegrityaswellasconfidentiality.

•  Twobasicsecuritynotions:integrityofplaintextsandintegrityofciphertexts.

Page 11: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

11

INT-CTXTsecurityinapicture

Adversary Challenger

m

c=EncK(m)c

Adversarywinsifc*is“new”andm*≠┴

K←KGen

Try(c*)m*=DecK(c*)

Page 12: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

12

IntegrityofCiphertexts–INT-CTXT

•  Attackerhasrepeatedaccesstoanencryptionoracleanda“Try”oracle.

•  Encryptionoracletakesanymasinput,andoutputsEncK(m).

•  Tryoracletakesanyc*asinput(andhasnooutput).

•  Adversary’staskistosubmitc*toitsTryoraclesuchthat:

1.  c*isdistinctfromalltheciphertextscoutputbytheencryptionoracle;and

2.  DecK(c*)decryptstomessagem*≠┴.

•  Henceadversarywinsifitcancreatea“ciphertextforgery”–anewciphertextthatitdidnotgetfromitsencryptionoracle.

•  NB:wedonotinsistthatm*bedifferentfromallthemqueriedtotheencryptionoracle,onlythatc*bedifferentfromalltheoutputsofthatoracle.

Page 13: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

13

INT-CTXTsecurity

•  AsymmetricencryptionschemeissaidtoprovideINT-CTXTsecurityifthesuccessprobabilityofanyadversaryusingreasonableresourcesissmall.

•  Again,thiscanbemadeprecise(butnottoday!).

Page 14: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

14

INT-PTXTsecurityinapicture

Adversary Challenger

m

c=EncK(m)c

Adversarywinsifm*is“new”andm*≠┴

K←KGen

Try(c*)m*=DecK(c*)

Page 15: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

15

INT-PTXTsecurity

•  INT-PTXT:sameasINT-CTXT,butnowadversaryneedstocomeupwithaciphertextc*thatencryptsamessagem*suchthatm*wasneverqueriedtotheencryptionoracle.

•  Informally,INT-PTXTsecuritymeansthattheadversarycan’tforceanewplaintexttobeacceptedbythereceiver.

•  IfaschemeisINT-CTXTsecure,thenitisalsoINT-PTXTsecure.

•  Forasecurechannel,weactuallywantINT-PTXTsecurity,notINT-CTXTsecurity.(Why?)

Page 16: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

DefinitionsforAESecurity

Page 17: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

RecallthatasymmetricencryptionschemeissaidtoofferAuthenticatedEncryptionsecurityif:

Achosenplaintextattackercanlearnnothingaboutplaintextsfromciphertextsexcepttheirlengths.

ANDAnattackerwithaccesstoanencryptionoraclecannotforgeanynew

ciphertexts.

17

AESecurity

Moreformally,wecannowsaythat:

AE=IND-CPA+INT-CTXT

Page 18: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

18

Whataboutchosenciphertextattacks?

•  Wearealsointerestedinsecurityagainstchosenciphertextattacks.

•  Heretheadversaryhasaccesstobothanencryptionoracleandadecryptionoracle.

•  LeadingtotheIND-CCAsecuritynotion,strongerthanIND-CPA.

•  Thisattackmodelmayariseinpractice,ortheattackermayhaveanapproximationtoadecryptionoracle.

•  Anattackermightnotbeabletolearnthefullplaintext,butcouldgetpartialinformationaboutthedecryptionprocess,forexample,errormessages,timinginformation,etc.

•  cf.paddingoracleattacks,ICMPattackonIPsec,etc.

Page 19: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

19

IND-CCAsecurityinapicture

Adversary Challenger

b←{0,1}

(m0,m1)

c*=EncK(mb)c*

b’ Adversarywinsifb=b’

K←KGen

c

┴/m=DecK(c)┴/m

Page 20: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

20

AESecurityimpliesIND-CCAsecurity

Informalreasoning:

•  SupposewehaveasuccessfulIND-CCAadversaryagainstanAE-securescheme.

•  Itsdecryptionoracleisonlyanyusetoitifitcancomeupwithanewandvalidciphertextc*notoutputbytheencryptionoracle.

•  Becauseotherwiseitknowstheunderlyingplaintextalready.

•  Butifitcancomeupwithanewciphertextc*,thenithasbrokenINT-CTXTsecurity!

•  Butthiscreatesacontradiction,sinceAEsecurityimpliesINT-CTXTsecurity.

•  Sowecanassumetheadversarynevercomesupwithavalidc*.

•  Thismeanswecanalwaysreplywith“┴”toanydecryptionquery.

•  ThismeanstheIND-CCAadversaryiseffectivelyreducedtobeinganIND-CPAone.

•  ButthiscontradictsAEsecuritytoo,sinceAEsecurityimpliesIND-CPAsecurity.

Page 21: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

21

Relationsbetweensecuritynotions

AE:IND-CPA+INT-CTXT

IND-CCA IND-CPA+INT-PTXT

IND-CPA INT-PTXT

Page 22: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

22

AEsecurityandbeyond

•  AEsecurityhasemergedasthenaturaltargetsecuritynotionforsymmetricencryption.

•  InpartbecauseAEsecurityimpliesIND-CCAsecurityandINT-PTXTsecurity.

•  Howeverit’snottheendofthestory:•  Inmanyapplicationswewanttointegrityprotectsomedataandprovide

confidentialityfortheremainder–AEwithAssociatedData,AEAD.

•  AEsecuritydoesnotprotectagainstattacksonsecurechannelsbasedonreorderingordeletionofciphertexts.

•  Forthis,weneedstatefulornonce-basedsecuritydefinitions.

Page 23: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Genericcomposition

Page 24: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

GenericcompositionforAE

•  WehaveIND-CPAsecureencryptionschemes(e.g.CBCmode,CTRmode)andwehaveSUF-CMAsecureMACschemes.

•  CanwecombinethesetoobtainAEsecurityforsymmetricencryption?

•  ProblemfirstaddressedbyBellare-Namprempre(2000)andKrawczyk(2001).

•  Genericoptions:E&M,MtE,EtM.

•  (Inwhatfollows,KMdenotesaMACkey,andKEanencryptionkey.)

24

Page 25: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

GenericcompositionforAE

Encrypt-and-MAC(E&M)

•  computec’←EncKE(m)andτ←TagKM(m)andoutputc=(c’,τ).

•  usedinSSHMAC-then-Encrypt(MtE)

•  computeτ←TagKM(m)andoutputc=EncKE(m||τ).

•  usedinTLSEncrypt-then-MAC(EtM)

•  computec’←EncKE(m)andτ←TagKM(c’)andoutputc=(c’,τ).

•  usedinIPsecESP“enc+auth”

25

Page 26: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

SecurityofgenericcompositionforAE

•  Genericoptions:E&M,MtE,EtM.

•  Ofthese,onlyEtMgivesAEsecurityingeneral.

•  AssumingencryptionisIND-CPAsecureandMACisSUF-CMAsecure.

•  Intuition:MACingtheciphertextc’providesciphertextintegrity;IND-CPAsecurityofencryptioncarriesovertothecomposition.

•  Pluspoint:checkMAConciphertext,don’tevendecryptifitfails;notemptationforprogrammerto“usetheplaintextanyway”ifMACfails.

26

Page 27: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

SecurityofgenericcompositionforAE

•  ToseewhyE&Mfailstobesecureingeneral:

•  SupposewehaveaSUF-CMAsecureMACscheme,withtaggingalgorithmTagKM(m).

•  ThinkabouttheMACschemewhichoutputsTagKM(m)||m.

•  IsitSUF-CMAsecure?

•  WhataboutthesecurityoftheresultingE&Mscheme?

27

Page 28: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

SecurityofgenericcompositionforAE

ToseewhyMtEcanfailtobesecureismoresubtle.

Example

ConsidertheMtEencryptionschemeinwhichMACisprovidedbyHMACandtheencryptionschemeisprovidedbyCBC-modeusingsimplifiedTLSpadding.

GoodMAC(SUF-CMA)andgoodencryptionscheme(IND-CPA)!

•  KGen:selectatrandomtwokeys,KM,KE.

•  Encryption:c=CBC-EncKE(TLS-PAD(m||TagKM(m))).

•  Decryption:???28

Page 29: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

SecurityofMtEgenericcompositionforAE

•  Encryption:c=CBC-EncKE(TLS-PAD(m||TagKM(m))).

•  Decryption:1.  PerformCBC-modedecryption.

2.  Performdepadding–possibilityofpaddingerror.

3.  PerformMACverification–possibilityofMACverificationerror.

Iftheerrorsatsteps2and3aredistinguishable,thenwecancarryoutapaddingoracleattack!

•  Paddingerror->paddingbad.

•  MACverificationerror->paddinggood!

Thisattackisaspecialcaseofachosen-ciphertextattack,whichshouldbepreventedbyAEsecurity(recallAEsecurityimpliesIND-CCAsecurity).

29

Page 30: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

SecurityofMtEgenericcompositionforAE

•  We’vejustseenanexampleofaschemeconstructedfromcomponentsthatarebothgood(IND-CPAsecureencryptionscheme,SUF-CMAsecureMAC)butforwhichtheMtEcompositionfailstobesecure.

•  TheexampleiscloselyrelatedtotheconstructionthatisusedinTLS.

•  SpecificwaysofinstantiatingMtEcanbemadesecure,butit’sunsafeingeneralandmustbeavoidedwhereverpossible.

30

Page 31: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

AEAD

Page 32: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

32

AuthenticatedEncryptionwithAssociatedData(AEAD)

Inpracticalapplications,weoftenrequireconfidentialityandintegrityforsomedatafieldsandonlyintegrityforothers.

Example:ESPintransportandtunnelmodesinIPsec

Inner

IPheader

Tunnelmode:

Outer

IPheader

Payload

(e.g.TCP,UDP,ICMP)

ESP

trlr

ESPhdrSPI,seq#

MACscope

Encryptionscope

Payload

(e.g.TCP,UDP,ICMP)ESPhdrSPI,seq#

Transportmode:

Original

IPheaderESP

trlr

ESP

auth

Encryptionscope

MACscope

ESP

auth

Page 33: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

33

AuthenticatedEncryptionwithAssociatedData(AEAD)

AnAEADschemeconsistsofatripleofalgorithms:(KGen,Enc,Dec).

KGen:keygeneration,selectsakeyKuniformlyatrandomfrom{0,1}k.

Enc:encryption,takesasinputkeyK,associateddataAD∈{0,1}∗,plaintextm∈{0,1}∗,andproducesoutputc∈{0,1}∗.

Dec:decryption,takesasinputkeyK,associateddataAD∈{0,1}∗,ciphertextc∈{0,1}∗,andproducesoutputm∈{0,1}∗oranerrormessage,denoted┴.

Correctness:werequirethatforallkeysK,forallassociateddatastringsAD,andforallplaintextsm:

DecK(AD,EncK(AD,m))=m.

AEADsecurity(informal):

IND-CPAsecurityformessagesm,integrityforcombinationofassociateddataADandciphertextc.

Page 34: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Nonce-basedAEAD

Page 35: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Nonce-basedAEAD

Nonce-basedAEAD=AEADwithnonces!

Motivation:

•  AEADschemesaswehavedescribedthemsofarmustconsumerandomnessinEncalgorithmtoachieveAEsecurity

•  (IND-CPAsecurityrequiresrandomisedencyption–why?)

•  Guaranteeinggoodsourcesofrandomnessishard.

•  It’sdangeroustohandthisresponsibilitytotheprogrammer,byaskinghimtosupplytherequiredrandomness(e.g.IVforCBCmode).

•  ItisarguablyeasiertoensurethattheprogrammeralwayspassesanewnoncevalueasoneoftheinputstotheEncalgorithm(alongwithmessagemandassociateddataAD).

35

Page 36: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

36

Nonce-basedAEAD

Anonce-basedAEADschemeconsistsofatripleofalgorithms:(KGen,Enc,Dec).

KGen:keygeneration,selectsakeyKuniformlyatrandomfrom{0,1}k.

Enc:encryption,takesasinputkeyK,nonceN∈{0,1}n,associateddata AD∈{0,1}∗,plaintextm∈{0,1}∗,andproducesoutputc∈{0,1}∗.

Dec:decryption,takesasinputkeyK,nonceN∈{0,1}n,associateddata AD∈{0,1}∗,ciphertextc∈{0,1}∗,andproducesoutputm∈{0,1}∗oranerrormessage,denoted┴.

Correctness:werequirethatforallkeysK,forallnoncesN,forallassociateddatastringsAD,andforallplaintextsm:

DecK(N,AD,EncK(N,AD,m))=m.

Page 37: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

37

Securityfornonce-basedAEAD

Nonce-basedAEADsecurity(informal):

IND-CPAsecurityformessagesm,integrityforcombinationofassociateddataADandciphertextc,foradversariesthatneverrepeatthe

nonceinencryptionqueries.

•  IntheIND-CPAsecuritygame,theadversarynowgetstospecifyapair(m0,m1),alongwithADandNinencryptionqueries.

•  AdversaryneverrepeatsN.

•  IntheINT-CTXTgame,adversarynowgetstospecifym,ADandNinencryptionqueries.

•  AdversaryneverrepeatsN.

•  Ideaofnoncerestriction:applicationwillensureanadversarycanneveraccessencryption/decryptionfunctionalitieswitharepeatednonce.

Page 38: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

38

Usingnonce-basedAEAD

Enc:encryption,takesasinputkeyK,nonceN∈{0,1}n,associateddataAD∈{0,1}∗,plaintextm∈{0,1}∗,andproducesoutputc∈{0,1}∗.Dec:decryption,takesasinputkeyK,nonceN∈{0,1}n,associateddataAD∈{0,1}∗,ciphertextc∈{0,1}∗,andproducesoutputm∈{0,1}∗oranerrormessage,denoted┴.Notes:•  Fordecryptionto“undo”encryption,thesamevalueoftheassociateddataAD

needstobeused.•  Buttheciphertextcdoesnot“contain”AD.•  Inapplications,ADmayneedtobesentalongwithc,orbereconstructedatthe

receiver.•  Fordecryptionto“undo”encryption,thesamenoncevalueNneedstobeused.•  Again,Nisnotincludedintheciphertextc.•  Inapplications,then,senderandreceivertypicallymaintainasynchronized

countertoensuretheybothusethesameNwhenencryptinganddecrypting.

Page 39: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

39

Usingnonce-basedAEAD

•  AsendsBasequenceofmessagesm0,m1,m2,…usingnonce-basedAEAD.

•  Ausesanincrementingcounterforthenonces;Busesthesamecountervalueswhendecrypting.

•  Whathappensiftheadversarydeletesaciphertext?

•  Whathappensiftheadversaryreorderstheciphertexts,deliveringc2beforec1,say?

•  Inbothcases,receiverwillusethewrongcounterduringdecryption,sodecryptionwillfail,producinganerrormessage;adversarylearnsnothing,andsocan’tarrangeundetectabledeletionorforceamessagetobedelivered“outoforder”.

c0=EncK(N=0,AD0,m0)

c1=EncK(N=1,AD1,m1)

c2

c2=EncK(N=2,AD2,m2)

c1

c0

m0=DecK(N=0,AD0,c0)

m1=DecK(N=1,AD1,c1)

m2=DecK(N=2,AD2,c2)

Page 40: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

FurtherConstructions

Page 41: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

41

AEADconstructions

SofarwehaveonlyseengenericconstructionsforAEschemes.

•  EtMistheonlyonethatissafetouse.

•  EtMextendstotheAEADsetting:

c’←EncKE(m);τ’←TagKM(AD||c’)andc=(c’,τ’).

•  NBthisisonlysecureifthelengthofADisfixedorotherwiseknowntobothEncandDecalgorithms.

•  EtMalsoextendstothenonce-basedsettingif“E”isanonce-basedencryptionscheme.

•  Example:CBC-modewithIV=EK(N)-usekeytoderive“random”IVblockfromnonce.

•  ManyotherAEADschemesareavailable;wewilllookatjusttwo,CCMandGCM.

Page 42: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

CCM

CCM=CounterwithCBCMAC.

•  Basically,aninstantiationofMtEwithM=CBC-MACandE=CTRmode,usinga128-bitblockcipher,e.g.AES.

Modifications:

•  Usesamekeyfor“M”and“E”components.(Badideaingeneral,OKhere.)

•  ApplyCBC-MACtothestring:h=N||len(m)64||m||len(AD)64||AD||padding.

•  Here,“||”meansconcatenate,len(X)64meansthe64-bitencodingofthelengthofstringX.

•  InitialcountervalueforCTRmodeist=N||064,whereNisthe(64-bit)nonce.

42

CTRmodeencryption

CBCMAC

Page 43: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

CCM

CCM=CounterwithCBCMAC.

•  CCMisquiteslow:itneedsonepassoverassociateddataADinCBC-MACandtwopassesoverthemessagem,oneinCBC-MACandoneinCTR-modeencryption.

•  CCMonlyusesblockcipherin“forwarddirection”,i.e.only“E”andno“D”.

•  CCMispatent-free.

•  CCMisusedinWPA2,thesuccessortoWEPandWPA/TKIP.

•  CCMisstandardisedforuseinIPsecandTLS1.2.

•  CCMisspecifiedinfullinRFC3610(https://tools.ietf.org/html/rfc3610).

•  CCMhasasasecurityproofbasedonblockcipherbeingapseudo-randompermutation.

•  Noknownattacks(whenimplementedproperly!)

43

Page 44: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

GCM

GCM=GaloisCounterMode.

•  Basically,aninstantiationofEtMwithE=CTRmodeusinga128-bitblockcipher,e.g.AES,andM=aWegman-CarterMAC.

•  NoncesNcanbeofarbitrarylength,specialprocessingfor96-bitcaseforspeed.

•  FasterthanCCM:speedupcomesfromuseoffastMACalgorithmbuiltfromuniversalhashfunctionfamilycalledGHASH.

•  GCMonlyusesblockcipherin“forwarddirection”,i.e.only“E”andno“D”.

•  ADandmcanbeprocessedinblock-wisefashion,nobufferingrequired.

•  GCMispatent-free.

•  GCMisstandardisedforuseinIPsecandTLS1.2,nowwidelyusedinTLS.

•  GCMisspecifiedinfullinNISTSpecialPublicationSP800-38D(2007).

•  GCMhasasecurityproofbasedonblockcipherbeingapseudo-randompermutation.

•  Noknownattacksofsignificance(whenimplementedproperly!)

44

Page 45: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

GCM(for96-bitnonces)

45

AD

N||1031

Encryptionmaskforuniversalhash

CTRmodeencryption

UniversalhashfunctiononAD||c||len(AD)64||len(c)64.

Page 46: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

OtherthingsyoushouldprobablyknowaboutAE

•  Othermodesareseeinggrowingadoption,e.g.OCB.

•  RecentSHA-3winnerKECCAKcanbeadaptedtoproduceanAEscheme!

•  Thewholeareawasmiredinpatentsonearlyalgorithmdesignsbutthesituationisgraduallyimproving.

•  Don’trelyonwikipediafordiscussionofthesecurityofgenericcomposition(itsaysMtEisOK;it’snotingeneral)!

•  CAESARcompetitionon-going(http://competitions.cr.yp.to/caesar.html),generatinglotsofnewresearchactivityandsomecontroversy.

•  SeealsotheAEzoohttps://aezoo.compute.dtu.dk/doku.php

46

Page 47: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

GoingStillFurther

Page 48: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

AEAD≠securechannel

•  Thinkabouttheapplicationdeveloper:•  She/hewantsadrop-inreplacementforTCPthat’ssecure.

•  Actually,she/hemightjustwanttosendandreceivesomeatomicmessagesandnotaTCP-likestream.

•  TowhatextentdoesAEADmeetthisrequirement?

•  Itdoesn’t…

48

Page 49: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

AEAD≠securechannel

There’sasignificantsemanticgapbetweenAEAD’sfunctionalityandrawsecurityguarantees,andallthethingsadeveloperexpectsasecurechanneltoprovide.

49

m1

m2

ChEnc(.,.,.)

Dec(.,.,.)

+

Page 50: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Example:cookiecutters

Bhargavan,Delignat-Lavaud,Fournet,Pironti,Strub2014:cookiecutterattackon“HTTPoverSSL/TLS”.

•  AttackerforcespartoftheHTTPheader(e.g.,cookie)tobecutoff.

•  Partialmessage/headerarrivesandmightbemisinterpreted.

50

c=Enc(Set-Cookie: SID=[AuthenticationToken]; secure)Ch

Set-Cookie: SID=[AuthenticationToken]

Page 51: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Cookiecutters

Whydoesn’tthisviolatetheprovenintegrityofSSL/TLSencryption?

6.2.1. Fragmentation

The record layer fragments information blocks into TLSPlaintext records [...]. Client message boundaries are not preserved in the record layer (i.e., multiple client messages of the same ContentType MAY be coalesced into a single TLSPlaintext record, or a single message MAY be fragmented across several records).

RFC5246TLSv1.251

Page 52: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Cookiecutters

Whydoesn’tthisviolatetheprovenintegrityofSSL/TLSencryption?

6.2.1. Fragmentation

The record layer fragments information blocks into TLSPlaintext records [...]. Client message boundaries are not preserved in the record layer (i.e., multiple client messages of the same ContentType MAY be coalesced into a single TLSPlaintext record, or a single message MAY be fragmented across several records).

RFC5246TLSv1.252

Page 53: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Cookiecutters

•  SoSSL/TLScan(andwill)fragmentwhensending.

•  ComparetoSSHthathastodealwithfragmentswhenreceiving.

•  Bothprotocolsprovideastreaminginterfacetoapplications,notamessage-orientedone.

53

Set-Cookie: SID=[AuthToken]; secure

ChSet-Cookie: SID = …

Set-Cookie: SID=[AuthToken]

2TLSrecords

Page 54: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Cookiecutters

•  It’suptothecallingapplicationtodealwithmessageboundariesifitwantstouseSSL/TLSforatomicmessagedelivery.

•  CookiecutterattackreliesonabuggybrowserthatdoesnotcheckforcorrectHTTPmessagetermination.

•  Thishappensinpractice,presumablybecausedevelopersdonotunderstandtheinterfaceprovidedbySSL/TLS.

54

Set-Cookie: SID=[AuthToken]; secure

ChSet-Cookie: SID = …

Set-Cookie: SID=[AuthToken]

Page 55: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

FromAEADtosecurechannels

Page 56: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

FromAEADtosecurechannels

•  SSL/TLSisnotaloneinpresentingastreaminginterfacetoapplications.

•  AlsoSSH“tunnelmode”,QUIC.•  Whatsecuritycanwehopeforfromsuchachannel?•  Boldyreva-Degabriele-Paterson-Stam(2012)alreadytreatedthecasewherethereceiverhandlesfragmentedciphertexts(butthesenderdoesnotproducethem).

•  ModeltunedtotreatmentofSSHencryption.

•  InFischlin-Günther-Marson-Paterson(2015),weprovidedasystematicstudyofthecasewherebothsenderandreceivermayfragment,asinTLS.

56

Page 57: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Streamingsecurechannels(FGMP15)

•  DefiningCCAandintegritynotionsinthefullstreamingsettingisnon-trivial!

•  Hardpartistodefinewhenadversary’sdecryptionqueriesdeviatefromsentstream,andfromwhichpointontosuppressdecryptionoracleoutputs.

• WedevelopstreaminganaloguesofIND-CPA,IND-CCA,INT-PTXTandINT-CTXT.

• Werecoverananalogueoftheclassicrelation:

IND-CPA+INT-CTXTèIND-CCA

57

Page 58: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Closingremarks

Page 59: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Closingremarks

• We’veseentheevolutionfromsimplesecuritymodelsforsymmetricencryptiontomoresophisticatedsecuritynotionsforsecurechannels.

•  YettherelevantpartofthecryptographycommunityismostlyfocussedonAEADandCAESER.

•  Keytake-away:thinktop-down,notbottom-up(fromAPItocrypto,notthereverse).

•  You’vealmostarrivedattheresearchfrontier!

•  Andtherearelotsofinterestingproblemslefttosolve!

59

Page 60: Authenticated Encryption - COSIC · Authenticated Encryption (AE) Security goals: Confidentiality and integrity of messages exchanged between Alice and Bob. Adversarial capabilities:

Closingremarks

60