Home

AES en C - Quentin Comte-Gaz

image

Contents

1. 7 9 xhbc xbe xdc xde xfc xfre x 7 x sb 0 27 0 25 47 045 67 0 65 0 67 085 5 7 5 Oxe7 0xes 12 0 11 22 0 21 0 72 0 71 0 42 041 Oxd2 0xdl DxeZ 0xel Oxb2 0xb1 0x82 0x81 USD xh3 xba 9 xzd 45 0 79 x29 xza 0x19 0xla x7e x77 xee xe7 0 45 0 4 0 45 0 0x08 0x01 0x98 0x91 0x33 0x34 0x92 0x9b x z x b 9 za 0x39 0x30 4 4 0 xdf xde 42 46 int MulB 256 1 0 200 0 0 16 1 2 0 27 31 8 3 3 45 0 74 72 0 62 0 69 0 6 9 597 81 8 3 25 4 2 2 0 9 7 70 6 66 57 41 0 23 0 28 0 35 0 04 08X19 0X12 Usch 0 0xd6 7 1 93 598 85 8 4 xaz 0 26 0 1 7 8 Oxb3 82 0 89 0 94 0 92 0 36 3 0 50 5 61 7 7 7 1 15
2. 0 0 0 10 0 2 2 30 4 3 50 Ox c 0x e 0x70 8 8 80 xec xce xf Ox17 0x15 0Ox b 37 35 2 57 55 4 77 75 6 37 35 8 Ozb7 0zb5 0zahb Ozd7 0zd5 0zcb Ozf7 Uzf5 U0zeb 0 09 0X18 39 28 69 7 8 59 48 0 9 8 xfa xf3 xe8 8 59 0X88 0x91 0X92 083 zal xaz xb3 xzf1 xfz xe3 1 0 2 0 51 0 52 0 43 Ox61 0x62 0x73 0x31 0x32 08x23 0x01 0x02 0x13 0x36 0X3 0x48 xa6 xaf xda x d 0x04 0x73 Oxdd 0O xdd 0 xe 0x40 49 0 0 0 49 7 72 0X05 2 95 0 43 4 Ox4a 0x43 0x34 1 8 92 0x71 0878 0 zac xas xdz US ZC US 23 0X42 x37 x e xe 8 z 7 x c z73 Ozi2 0x14 0x16 0x18 0xla 032 0x34 0x36 0238 0x34 0 52 0 54 0 56 8 0X58 0 72 0 74 0 76 78 Ox92 0 34 0X96 38 Oxb2 4 6 0xb8 0 42 4 6 0 xf2 xf4 xfe xf xfa x 3 x f x d x 3 s x l 0x29 0x2 0x2d 0x23 0x21 0x49 0x4
3. 068 03 0 32 0 39 0 24 0 2 8 86 3 30 1 7 3 68 9 22 2 0 4 0 3 0 36 0 2 20 11 1 07 0 65 73 76 389 0 4 2 0 52 0 54 27 1 0 0 0 6 Uxaf Uxad 9 2 0 83 88 35 0 Ox47 0x4c 0x51 0xS5a 0x6b 0X60 0x7d 0x76 0x1 f 0x14 0x09 0x02 0x33 0x38 0x25 0x e x c x 7 x8a x351 xa xah xba xbd xd3 xdf xc2 xc xfda xf3 xee xeb xic x37 xzca x21 xl xihb 0X06 04 64 6 72 0 79 0 38 4243 5 0 55 0 01 0 0 0 17 1 0 2 0 26 3 30 59 0 52 382 44 0 75 7 63 0 68 1 7 3 36 8 80 2 2 24 5 xd 7 71 6 67 5 6 5 40 4 22 0 29 34 32 0 0X05 0x183 0x13 1 0 4 7 0 6 UxfU Uzfb Ux92 Ux99 0x834 8 Uzbe Uzb5 Uza 0xa3 int MulD 256 0 00 0 0 1 17 34 0 39 0 0 23 68 65 72 0 72 51 46 4 0 40 Oxdd 7 4 Uxfe 3 xab 0xb5
4. 0 1 xzbe 0 4 xea Ox4d 0x91 1 0 6 xfa Ox66 x Oxdd 10 9 0 2 x z Oxbc zcb 39 Cx3a xda Oxef Oxcc 1 xb3 x34 20 0x40 35 OxBf 25 0x04 0x08 0x63 6 Oxbd z l Ox8d 0x01 2 use 72 xe4 0x74 xe xah Oxdd Oxc5 91 Ox83 1 0x36 6 0 74 Oxfa Ox33 66 FIGURE A 4 Rcon 12 0x30 4 10 9 0 2 x z Oxbc Usch 39 Ox3a oxda xef xib Oxb3 0x94 0x20 35 x3f 0x04 0x63 Oxbd xad xz 2 x74 Oxab Oxc5 0x83 36 0x40 0 25 0 08 0 6 61 01 Ox5e 0 4 0 8 Ox4d 0x91 oxid 0 6 xfa 66 0x80 Oxd Cx a 10 x37 0 2 x z xbc xd3 Oxcb 0x39 Cx3a xda User 0 Oxlb xb3 x34 0x20 x35 9 04 0 63 xbd Ox8d 2 DETZ Ox74 Oxab 0 5 83 0x36 3 40 25 0 08 0 6 61 x l xbe Oxed Oxe 42 91 1 0 6 66 0x80 Oxd Oxda 0x10 x37 0 2 0 02 Oxb
5. 07 15 1 Uzal Uzaf Uxbd 3 398 0X97 0X85 USD 1 Uzcd 3 9 7 1 5 34 0 86 88 2 4 2 6 2 8 2 0 7 74 66 68 42 3 5 50 0X04 16 18 32 3 2 0 20 2 0 2 0 4 4 8 6 9 0X92 80 4 4 xaa xb xb OxOc 0x02 0x10 0x1e 0x34 0x3a 0x28 0x26 0x7c 0x72 0x60 0x6e 0x44 0x4a 0X583 0X56 0x37 0x39 0x2b 00x25 0x0f 0x01 0x13 0x1d 0x47 0x49 0x5Sb 0x55 0x7f 0x71 0x63 0x 6d Oxd7 0xd9 0xcb 0xcS 0xef Usel Uxf3 Uzxzfd Uza Uzad Oxbb 0xb5 0X9 0x1 0283 0x8d FIGURE Tables de galois B D E 11 int Econ 255 Ox8d 2 2 OxT xab 5 83 0x36 x7d x33 Oxd 0 25 0 08 6 61 01 xbe 0 4 8 4 0x91 1 0 6 Oxfa 66 x xd4 Oxda 10 0x97 0 2 x z Oxbc Usch 0x39 Cx3a oxda xef Oxlb Oxb3 94 0x20 35 9 0 04 63 xbd Ox8d Oz f 2 4 Oxab 5 0x83 0x36 x7d x33 Oxd 25 0 08 0 6 61
6. 2 2 8 81 396 0 9 Oxbb xb 6 1 82 82 0 95 0 98 9 4 7 2 0 0 0 6 66 71 7 5 52 45 48 03 0 19 14 37 24 0 20 0 6 0 60 77 59 54 43 4 05 08 1 12 0 31 3 2 0 26 Oxbd 7 89 84 93 Ox d5 686 2 1 2 6 6 0 1 2 2 8 2 5 3 4 3 687 30 US DOC 06 0 1 2 11 32 0 32 0 28 0 25 63 74 798 57 40 US CO 047 0 3 4 9 2 Uxbf usa 86 6 9 0291 0 0 07 10 1 3 33 0 24 0 29 0 62 0 62 78 75 6 4 0 41 61 0 7 76 55 8 4 42 0 09 04 13 1 3 0X30 0X27 2 1 6 685 88 92 0 92 0 0 4 0 23 0 7 7 0 683 8 Ux dd 0 94 2 0 8 6 0X1 Oste
7. 0 67 7 0 70 3 49 44 0 02 15 18 3 36 21 0 2 0 0 1 16 1 38 0 35 0 22 04 22 64 69 7 73 50 5 42 7 0 0 1 0 6 8 2 2 2 8 0xbS Oxae Usaz 0x30 0x8d 0X98 0897 int MulE 256 0 00 0 1 12 0 38 0 36 0 248 0 2 7 6 62 38 46 54 5 0 0 22 0 6 3 90 8 82 6 4 Uxba 0 4 5 0 45 7 9 3 2 1 7 9 0 33 34 682 0 81 3 35 0 27 29 0x03 0x0d 0x1 f 0x11 0x4b 0x45 0x57 0x59 0x73 0x7d 0x6f 0x61 Uxad Uxaj U0xbl Uxbf Ux55 Ux5b 0x89 US 7 Uxdd 43 1 1 9 13 0 43 51 52 0 75 7 69 0x67 0x3d 08233 08x21 0X2 0x05 0x0b Oz15 0z17 0X76 0X78 0Xx6a 0x64 0x4e Oxk40 0x52 0x5c 0x06 08 1 14 30 0 0 22 0 2 0236 38 84 0 2 6 24 0 0 2 31 0 484 0 54 53 0 79 0 77 65 6 31 3 2 0 23 08
8. 8 x l OxSb 41 Oxbf 0x34 r zee r xT xd4 xbe r z E7 zcl r 0X97 ruxe rOx6f 2 zbl Ox d ruzca 1 inv S Box Rcon et x l1 4 xah 12 Ox3b Ozcb xf3 Oxb6 56 Oxdd 0x35 Oxle x38 Ox40 XE xic e XSD 0 4 15 r ze d rUxaf x 2 e xf3 e xb7 zdb r 0X12 ges P xeb x63 xe7 2 0 5 0 80 6 Oxbe 0 02 xda US Ze xbda zxf4d x74 x57 0x87 0 2 r 43 r 95 P xaz r DXSC r 0X46 r 58 Oxbd r zcf s x37 r 62 USCH r xl e US Ta r Oxbb zl FIGURE A 1 S Box et S Box inv 0x44 e x b r 0849 2 r0xS57 e USD e 03 r ze OxDe ruzfe x58 e x8f xic r 0X63 xfe x c 0x71 zeb 0x29 Ox50 xl 64 Oxde 0x91 Ox65 Oxdb Ox86 xce xb Ox81 ruzci P xd42 r Dx6d r xbd ruxa DXDE e 01 xf rOzlc r DEAR x78 e USA e 0X93 e 0X83 x55 4 0 8 x27 xe3 4 US ZC Ozff Ox5d 5 0x95 xTa xbd xci 55 Ox54d Oxf3 r xde s xfa e ZBb r USD US ZO xb3 r 0X13 xbd4 US IDN r 0X18 xcd r 0X80 r USCH r 0X53 r 0X
9. 3 zla xed z b 8 Oxdc z a xed 2 66 11 x d Oxd5 r 0X32 r 0X32 0x66 r 0X64 r 0X50 r x r z86f r 0841 s x22 r US ZIL r Dx4b r x33 e 9 4 r xT7e xf2 xfa 36 18 xib 0 20 43 92 5 0 22 0x49 x d 1 0x48 0x69 Oxbf x3 r x8b Dxab r z26 r OXG zfd rO z8c rUxzca rUxAf r zet Ozld 20 6 r 0X88 e 0X19 xae e zba Ox6b 0x59 3 0x96 Ozfc Oxdd Ox9d x37 2 06 5 xab 0x03 xd8 0 6 0x36 ruzaf r zc2 r 9 r 68 ruzed rs x3f r0x67 e xad r 0X29 rOxd2 e x T e xbs5 r zx2a r DETT 6 4 7 xf7 0x05 xba xbl x33 0x38 44 0x90 24 Oxde Oxbd Oxf6 8 Oxd2 5 r zff r 0X23 r 24 r DXSE r 0Xb9 r x f r xde x35 r zc r 9 USC r DES r xde USCH xf 0 za xbb Ox85 zxf5 0x17 88 DESC 0 6 0 0 0x94 0 68 38 r DX6 1 z d zb rOxl 6 rO zda x a r 0X02 ruzea r zt5 0X89 r 20 P x31 Oz d e xb 2026 0x30 xad 34 0 52 0 45 Oxbc 4 46 2 6 0
10. 21 Oxab x72 x31 xb2 Oz2f Ox58 3 xf3 0x19 x b Oxed Oxae Ox8b 1 0x28 Oxbb Oxd7 xe r zc3 1 Uxb6 z d zd5 x a r ze6 DEdE zbe 2 rOzec ruzdc 0X99 z c 6 zc 15 75 84 8 2 0x73 Oxdb 0x79 08 Oxd 16 j Oxfb 2 r zde e x25 r DX92 zt r x a rOx6b z73 x e xib rUxf DESE ruzet rUx6l z7d fi Table de multiplication utiliser dans InvMixColumns tables de Galoc s 3 8 ffhttp fen vikipedia org wik1 Ri ndael mix columns int Mul2 256 1 0x00 0X02 0 04 0 06 0 08 0 0 0 0 0 22 0 24 0 26 0 28 0 2 0 40 0 342 0 34 0 36 0 428 0 0 60 0 62 0 64 66 68 80 0 82 0 84 0 86 0 68 0 2 4 6 8 0 2 4 6 8 USCH 0 2 4 6 8 1 13 12 1 13 11 3 33 32 3 33 31 0 5 53 5 5 53 Ost 7 79 7 73 71 OzBb 0X99 Oz5f 3 02x93 0891 Ozbb xb Ozbf xb3 1 xdh xd3 xdf xdd xd3 xd1 xfh xf23 xff xfd xf3 zZf1 int Mul3 25
11. 32 octets Voici le cryptage d cryptage du message de 16 octets et celui de 32 octets Pa DADropboxlProyeteryptolaes exe B D lt message a crypter 22 33 dd 55 66 77 88 99 aa hh cc dd ee ff message crypte eH 46 Th dd 3 48 cd bY 88 TH b4 ch ba message decrupt 6 e 22 33 44 55 66 77 BB 99 aa hh cc dd ee ff FIGURE 3 1 Resultat du cryptage d cryptage d un message de 16 octets a D Dropbox Projetcrypto aes exe zi x Hotre message a crypter 61 62 63 64 65 bb 67 68 69 ba bh bc d e bf VA WI 92 73 V4 75 96 YY Y8 99 Va dB 31 32 33 34 35 Notre message crypte d2 53 63 fc 72 13 37 64 Ba 68 f3 da be f3 b4 HB 6h d 58 94 bc 56 fe e 57 fic eb ed 15 44 h 2h Hotre message decrypte 61 62 63 64 65 bb 67 68 69 ba h bc bd 6e of VA Y 72 V3 4 YB T YY Y 99 Za 3H 31 32 33 34 35 FIGURE 3 2 Resultat du cryptage d cryptage d un message de 32 octets ISO NH N 3 2 Test de norme Pour savoir si notre message crypt peut tre d crypt avec la clef par n importe quel programme il faut suivre la lettre le standard Advanced Encryption Standard AES Pour verifier que cette norme est bien respect e il faut verifier chaque tape de notre cryptage que nous avons le m me resultat que celui de la norme cf annexe B Nous avons pour cela cr une nouvelle fonction permettant d afficher en h xad cimal notre message de 16 octets dont voici le code source et l
12. 6 0 00 0 03 06 0 5 0 30 33 36 35 3 3 0x60 0X63 66 65 6 6 0 50 0 53 56 55 5 0 5 0 0 0 3 6 5 20 3 6 25 2 Oxa 3 6 xac USD 0893 96 0295 9 zf 0296 58 94 97 0894 8 7 4 x h xf xfd zfe xf7 zxf4 68 7 4 zbh xz58 xd xbe xb57 0x53 Cx6b 0x68 0x6d 0x 6e 0x67 0x64 03b 0x38 0x3d 0x3e 0x37 0x34 x b x x d x e x 7 x 4 int Mul 256 0x00 0X09 0X12 OX1b 0x24 2 0x90 0X99 0x82 0X8b 0xb4 Ozbd 0x3b 0x32 0x29 0 20 12 16 2 OxbS 82 86 6 7 64 0x6d 0X52 025b xea8 zef xf43 zxfd xec2 xcb 44 0x44 OX5 0x56 0x69 0x60 xzdd xzd3 zc xce xf2 zxf xec xzeb zxfe zf7 Uxca xcl1 7 2 75 67 8 51 0 7 0 23 OXEA 47 3 55 63 93 0 88 0 81 0 0 03 18 11 2 0 2 7 1 0 8 3 85 8 0231 038 0 23 2 15 1
13. 668a3157244d17 2dfb02343f6d12dd09337ec75b36e3f0 2d6d7ef03f33e334093602dd5bfb12c7 6385b79ffc538df997be478e7547d691 247240236966b3fa6ed2753288425b6c 36400926f9336d2d9fb59d23c42c3950 36339d50f9b539269f2c092dc4406d23 f4bcd45432e554d075f1d6c51dd03b3c c81677bc9b7ac93b25027992b0261996 e847f56514dadde23f77b64fe7f7d490 e8dab6901477d4653ff7f5e2e747dd4f 9816 7400187155662 049 8 4036 c62fe109f75eedc3cc79395d84f9cf5d b41518016858552e4bb6124c5f998a4c b458124c68b68a014b99f82e5f15554c c 7elc159a9bd286105f4be098c63439 d1876c0f79c4300ab45594add66ff41f 3e175076b61c04678dfc2295f6a8bfc0 3e1c22c0b6fchf768da85067f6170495 baa03de7a1f9b56ed5512cha5f414d23 fde3bad205e5d0d373547964ef1fe37f1 5411f4b56bd9700e96a0902fa1bb9aal 544990a16ba09ab596bbf40eca111702f e9f74eec023020f61bf2ccf2353c21c7 bd6e7c3df2b5779e0b61216e8b10b689 7a9f102789d5f50b2beffd9f3dcadea7 7ad5fda789ef4e272bca100b3d9 59f 69c4e0d86a7b0430d8cdb78070b4c55a 13 INVERSE CIPHER DECRYPT round 0 iinput 69c4e0d86a7b0430d8cdb78070b4c55a round 10 ioutput 00112233445566778899aabbeeddeeff 14
14. DES qui tait jusque l le standard devenait de moins en moins Sur 1 2 Fonctionnement Ce syst me de cryptage est de type sym trigue Il faut noter que ce type de cryptage est rapide et utilise des cles relativements courtes Mais en contre partie L change de cl est difficile On utilise donc un syst me compl mentaire le RSA lors de l change de cl Le fonctionnement de l AES 128 est bas sur le d coupage du message crypter en bloc de 128 bits 16 octets En fonction du niveau de cryptage voulu on choisi une cl de 128 192 ou 256 bits Les 16 octets en entr e sont permut s selon une table definie au prealable Ces octets sont ensuite plac s dans une matrice de 4x4 l ments et ses lignes subissent une rotation vers la droite L incr ment pour la rotation varie selon le num ro de la ligne Une transformation lin aire est ensuite appligu e sur la matrice Finalement un XOR entre la matrice et une autre matrice permet d obtenir une matrice interm diaire Ces differentes op rations sont r p t es plusieurs fois et d finissent un tour Le nombre de tours change en fonction de la taille de la cl et donc du niveau de s curit attendu Le table ci apr s regroupe l ensemble des caracteristiques pour l ensemble des AES Nb Taille des blocs en mots de 32 bits N N N Nk Taille de la cl en mots de 32 bits AES 128 4 4 110 Nr Nombre de tours es A 6 4 12 r r F
15. IGURE 1 1 Configuration de PAES 1 3 Attaques Cet algorithme a t con u pour r sister tous les types d attaques connus Il rend le cassage lin aire et diff rentiel impossible A ce jour la force brute est l une des seules solutions possibles N anmoins si un jour PAES venait tre cassable facilement il suffirait d augmenter la taille de la cl cf Tableau pr cedent Notons qu il n exite pas de cl s faibles pour ce syst me pour le moment 2 Le cryptage d cryptage 2 1 Cr ation des clefs de ronde KevExpansion Nous avons une fonction g n rant une cl al atoire sur 128 bits Cette cl sera le point de d part des cl s de ronde La fonction KeyExpansion va former Nb Nr 1 mots Elle va commencer par faire une permutation circulaire puis on va appliquer la 5 box pour finir par cr er les cl s de ronde 2 2 Les differentes tapes lors d un tour 2 2 1 Ajout des clefs de ronde au message AddRoundKey Cette fonction permet de faire un XOR entre le message d entr e et la cl de ronde 2 2 2 Permutation du message Inv SubBytes Permute chaque l ment du message par un l ment de la S Box On notera que cette permutation est non lin aire 2 2 3 D calage Inv ShiftRow D calage cyclique des lignes des blocs messages de 0 puis 1 puis 2 puis 3 vers la gauche pour les ler puis 2 me puis 3 me puis 4 me ligne 2 2 4 Transformation lin aire Inv MixColumns Cett
16. PROJET DE CRYPTOLOGIE ENCADRE PAR M MICHAUT ET M DAVID 2 2 Cryptage d cryptage de IP AES 128 bits en langage C Par Quentin Comte Gaz et Adrien Lillo Sommaire 1 Pr sentation sommaire de PAES 128 bits 2 1 1 Origine 2 1 2 Fonctionnement EK KK KK KK KK KK KK KK KK KK KK KK 2 1 3 Attaques e 2 2 Le cryptage d cryptage 2 1 Cr ation des clefs de ronde KevExpansion 2 2 Les differentes tapes lors d un tour 3 2 2 1 Ajout des clefs de ronde au message AddRoundKey 2 2 2 Permutation du message Inv SubBytes 3 2 2 3 D calage mv ShiftRov 3 2 2 4 Transformation lin aire Inv MixColumns 3 2 3 La fonction de cryptage d cryptage d un message de 16 octets 4 2 4 La fonction de cryptage d cryptage d un message entier 4 Les tests 3 1 Test de fonctionnement 5 3 2 Test de norme n aoaaa K K K K KEK K K KK 6 4 Mode d emploi 7 A Les tables utiliser inv S Box Rcon et MulGF256 9 Les vecteurs de test 13 1 Pr sentation sommaire de PAES 128 bits 1 1 Origine L AES ou Advanced Encryption Standard est devenu le nouveau standard de cryptage en 2000 apr s avoir remporter le concours du m me nom En effet le
17. c xd3 Oxcb 39 US za xda Oxef xih zb3 94 20 35 9 0 04 63 Oxbd B Les vecteurs de test AES 128 Nk 4 Nr 10 PLAINTEXT 00112233445566778899aabbccddeeff KEY 000102030405060708090a0b0c0d0e0f CIPHER ENCRYPT roundi O input round 1 start round Us box round 1 5 row round Um col roundi 21 start round 2 5 box round 2 s_row round 2 m_col roundi 3 start round 3 s box round 3 s_row round 3 m col roundi Al start round Als box round 4 5 row roundi Am col roundi l start round 5 s box round Als row round 5 m_col roundi 6 start round 6 s_ box round 6 s_row round 6 m col roundi 7 start round 7 s box round 7 s_row round 7 m col roundi 8 start round 8 s_box round 8 s_row round 8 m_col roundi 9 start round 9 s box round 9 s_ row roundi Olm col round LO start round 10 s_ box round 10 s row round 10 output 00112233445566778899aabbccddeeff 00102030405060708090a0b0c0d0e0f0 63cab7040953d051cd60e0e7ba70e18c 6353e08c0960e104cd70b751bacad0e7 5f72641557f5bc92f7be3b291db9f91a 89d810e8855ace682d1843d8cb128fe4 a761ca9b97be8b45d8ad1a611fc97369 afbela6997ad739bd8c9ca451f618b61 87968431486 51645151 773 4009 4915598f55e5d7a0daca94fa1f0a63f7 3b59cb73fcd90ee05774222dc067fb68 3bd92268fc74fb735767che0c0590e2d 4c9c1e66f77110762c3f868e534df256 fa636a2825b339c940
18. e exi textecrypte bd 1 3021a3d34bf2221dcece02es65747a3a739a03005d3fflb75c0cb2c9a33b512078pcb7cfe43c726 FIGURE 4 1 Les diff rents fichiers du projet Le projet est compos de 5 fichiers Trois fichiers texte comportant respectivement la cl de cryptage le texte clair crypter ou apr s d cryptage ainsi que le texte crypt On notera que le texte crypt ainsi que la cl sont enregistr s en hexad cimal Cela permet d viter lam biguit de certains caract res ASCII comme le saut de ligne Pour compiler ce projet il suffit de complier le fichier aes c Il est important que les trois fichiers textes soient pr sents car sinon le programme de fonctionnera pas Tout texte devant tre crypt doit tre copi au pr alable dans texteclair txt a DADropbox Projeteorjptoaes exe BES 128 bits par Quentin Comte Gaz et Adrien Lillo i reation d une clef aleatuire 2 Cryptage du fichier texteclair txt clef clef txt gt i Derruptaqe du fichier textecrupte txt tclef clef txt gt 4 Faire le test du document fipsiT 7 definissant l AES k uitter le programme Tapez le numero correspondant a votre choix FIGURE 4 2 Le menu du programme 1 Cr ation d une clef al atoire G n re une cl al atoirement puis l enregistre dans clef txt 2 Cryptage du fichier texteclair txt clef clef txt Crypte le fichier texteclair txt avec la cl en
19. e fonction m lange les colonnes du bloc message Les colonnes sont consid r es comme des polyn mes de GF 25 et multipli es modulo z 1 avec un polynome a x fix tel que a x 3 x x x x 2 2 3 La fonction de cryptage d cryptage d un message de 16 octets Texte en clair tape initiale AddRoundKey Etape standard SubBytes Shifthows N 1 iterations MixColumns AddRoundKey Etape finale SubBytes ShiftRowss AddRoundkey Texte chiffr FIGURE 2 1 Foncionnement g n ral de PAES Maintenant que chaque fonction a t d crite il est plus commode de comprendre le fonctionnement du cryptage gr ce au sch ma ci dessus On aper oit tr s clairement que la cl de a r ussite reside dans le nombre d it rations des fonctions pr cedentes Notons que pour le d cryptage le sch ma est quasi identique Il suffit d utiliser les fonctions inverses 2 4 La fonction de cryptage d cryptage d un message entier Un message complet est en g n ral constitu de plus de 16 octets il faut donc r it rer le sch ma pr c dent l ensemble des blocs du message Notons que si un message n est pas divisible par 16 il faudra rajouter des l ments NULL au message afin de le crypter Les tests 3 1 Test de fonctionnement Ce test a pour but de crypter d crypter avec le m me programme que nous avons cr Nous avons pour cela crypt d crypt un message de 16 octets puis un message de
20. e r sultat obtenu void affichage unsigned char xin int j for j 0 j lt TAILLEMESSAGE j printf 02 2x in 11 17 printf ina Listing 3 1 Fonction permettant l affichage de TAILLEMESSAGE octets en hexad cimal printf round d s box round afficha ge MESSAGE Listing 3 2 Ce qu il faut rajouter dans la fonction de cryptage d cryptage D Dropbox Projetcrypto aes exe CENCRYPFT Hl input BB l start 11 hox l z ruu il m col l start sl zs h x 1 5 1 mcol dl start 31 s hox 31 s_rou 61 start 61 5 box 61 5 61 m col dl statt 21 5 21 5 21 1 l start 81 s hox 81 81 col q stamrmnt 71 s_hox 91 5 s1 m col round id1l start roundlibl s hox roundlibl s round id outputt INVERSE CIPHER CDECRYPT gt roundi Hl iinput 69 cd eH 48 ba h dd 36 46 cd h 88 VA hd ch Ba ruundliHl inutput uH 11 22 33 44 55 66 YY 88 99 aa hh dd ee ff FIGURE 3 3 Resultat du test qui est bien en accord avec la norme en annexe B 4 Mode d emplo1 izi 19 01 2013 16 48 Source File 27 BES EXE 19 01 2013 16 48 Application g clef txt 19 01 2013 16 49 Fichier TAT ii texteclair txt 19 01 2013 16 55 Fichier TAT amp textecnypte txt 19 01 2013 16 50 Fichier TAT clef bd 1 02dad84a831e7436745003ee5bal2f6 1 Ardeo mihi credite Patres conscripti id quod vosmet de m
21. f 0x4d 0x43 0x41 Ox63 0x6f 0x6d 0x63 0z61 0x89 0x8 0x6d 0x83 0x81 1 1 0 9 3 1 OzeB Uzef Uzed Uzeij 0xzel zilh xle xld xli3 zxl7 z2b 0x2e 0x2d 0x24 0x27 z7b xzxTe x7d z73 z77 Ox4b 0x4e 0x4d 0x44 0x47 zdh zde 0444 xd7 4 ze3 xbb xbe xhd xbi xb 7 0 8 8 8 84 0 867 0280 0 85 686 8 8 xb xb5 xba xbf xbc 0 0 0 5 6 2 0 0 0 5 6 42 xdc 0 30 0 35 0 36 322 4 0 270 0 75 0 76 72 0 0 0 25 0 26 0 22 0 2 10 15 16 12 1 0 41 53 6 65 0 41 0 3 2 5 7 61 68 5 7 5 xeca xf1 xfa xc7 xce 0x237 0x2c 0x25 0x1la 0x13 Oxa7 0xbc 0xbS5 0x8a 0x83 0 02 17 1 0 21 0 28 0 9 87 1 Oxad 6 80 08x859 0 3 26 0 22 10 19 36 84 84 2 0x06 0x1d 0x14 0x2b 0x22 Oxdb xc0 Uxc d zfo6 Uzfi 0x4b 0x50 0x59 0x66 0x6 0 0 0 2 4 0x70 0x6b 0x62 0x5d 0xS54 FIGURE 2 Tables de galois 1 3 9 10 zlc xle 3
22. registr e dans clef txt Le message crypt est enregistr dans textecrypte txt 3 Decryptage du fichier textecrypte txt clef clef txt D crypte le fichier textecrypte txt avec la cl enregistr e dans clef txt Le message d crypt est enregistr dans texteclair txt 4 Faire le test du document fips197 definissant AES D roule l ensemble des tests de la norme AES sous vos yeux afin de v rifier le bon fonctionnement de l agorithme de cryptage d cryptage A int aboz 256 int 0x63 Oxb7 x 4 x 8 Ox53 xd 51 xcd 0 60 ze xe 7 xba 0x70 Oxel 0 8 sboxinv 256 Ox52 DETE xb4 08 r 2 r zbc 90 xd P x3e r Dx47 ruzfc s xif r DX60 P Xal zl7 Les tables a utiliser MulGF256 7 82 Ozc7 0x83 Oxd1 Ozas Oz c 81 x32 xc 0x78 US ze Oxf8 xal e x B 0x6a xe3 e US Zb zze r Uxf r xT xd xzZc z l zac rUzfl rO x56 xdd x51 Dxe z b xca 0x93 0x23 2 Ox00 40 13 4 x37 0 25 xb5 98 0 89 au e 39 e 94 za1 e Oxf6 r 08x48 xab xle xll e US Z rUxla ruzije e gas e xT e x3b 0x04 0 26 0

Download Pdf Manuals

image

Related Search

Related Contents

Black Box RM112-R2 rack accessory  StarTech.com 4 Port 1U Rackmount USB PS/2 KVM Switch with OSD  Audiovox DT7 User's Manual  BT DECTfax Plus Fax Machine and digital system User's Manual  KM-40T(3.5MB)  Gabinetes de secagem e tampas para vapores sem dutos  Enrolladores Hood SL    

Copyright © All rights reserved.
Failed to retrieve file