Menu
AWS Encryption SDK
Developer Guide

AWS Encryption SDK Message Format Examples

The information on this page is a reference for building your own encryption library that is compatible with the AWS Encryption SDK. If you are not building your own compatible encryption library, you likely do not need this information.

To use the AWS Encryption SDK in one of the supported programming languages, see Programming Languages.

The following topics show examples of the AWS Encryption SDK message format. Each example shows the raw bytes, in hexadecimal notation, followed by a description of what those bytes represent.

Non-Framed Data

The following example shows the message format for non-framed data.

Copy
+--------+ | Header | +--------+ 01 Version (1.0) 80 Type (128, customer authenticated encrypted data) 0378 Algorithm ID (see Algorithms Reference) B8929B01 753D4A45 C0217F39 404F70FF Message ID (random 128-bit value) 008E AAD Length (142) 0004 AAD Key-Value Pair Count (4) 0005 AAD Key-Value Pair 1, Key Length (5) 30746869 73 AAD Key-Value Pair 1, Key ("0This") 0002 AAD Key-Value Pair 1, Value Length (2) 6973 AAD Key-Value Pair 1, Value ("is") 0003 AAD Key-Value Pair 2, Key Length (3) 31616E AAD Key-Value Pair 2, Key ("1an") 000A AAD Key-Value Pair 2, Value Length (10) 656E6372 79774690 6F6E AAD Key-Value Pair 2, Value ("encryption") 0008 AAD Key-Value Pair 3, Key Length (8) 32636F6E 74657874 AAD Key-Value Pair 3, Key ("2context") 0007 AAD Key-Value Pair 3, Value Length (7) 6578616D 706C65 AAD Key-Value Pair 3, Value ("example") 0015 AAD Key-Value Pair 4, Key Length (21) 6177732D 63727970 746F2D70 75626C69 AAD Key-Value Pair 4, Key ("aws-crypto-public-key") 632D6B65 79 0044 AAD Key-Value Pair 4, Value Length (68) 41734738 67473949 6E4C5075 3136594B AAD Key-Value Pair 4, Value ("AsG8gG9InLPu16YKlqXTOD+nykG8YqHAhqecj8aXfD2e5B4gtVE73dZkyClA+rAMOQ==") 6C715854 4F442B6E 796B4738 59714841 68716563 6A386158 66443265 35423467 74564537 33645A6B 79436C41 2B72414D 4F513D3D 0002 Encrypted Data Key Count (2) 0007 Encrypted Data Key 1, Key Provider ID Length (7) 6177732D 6B6D73 Encrypted Data Key 1, Key Provider ID ("aws-kms") 004B Encrypted Data Key 1, Key Provider Information Length (75) 61726E3A 6177733A 6B6D733A 75732D77 Encrypted Data Key 1, Key Provider Information ("arn:aws:kms:us-west-2:111122223333:key/715c0818-5825-4245-a755-138a6d9a11e6") 6573742D 323A3131 31313232 32323333 33333A6B 65792F37 31356330 3831382D 35383235 2D343234 352D6137 35352D31 33386136 64396131 316536 00A7 Encrypted Data Key 1, Encrypted Data Key Length (167) 01010200 7857A1C1 F7370545 4ECA7C83 Encrypted Data Key 1, Encrypted Data Key 956C4702 23DCE8D7 16C59679 973E3CED 02A4EF29 7F000000 7E307C06 092A8648 86F70D01 0706A06F 306D0201 00306806 092A8648 86F70D01 0701301E 06096086 48016503 04012E30 11040C28 4116449A 0F2A0383 659EF802 0110803B B23A8133 3A33605C 48840656 C38BCB1F 9CCE7369 E9A33EBE 33F46461 0591FECA 947262F3 418E1151 21311A75 E575ECC5 61A286E0 3E2DEBD5 CB005D 0007 Encrypted Data Key 2, Key Provider ID Length (7) 6177732D 6B6D73 Encrypted Data Key 2, Key Provider ID ("aws-kms") 004E Encrypted Data Key 2, Key Provider Information Length (78) 61726E3A 6177733A 6B6D733A 63612D63 Encrypted Data Key 2, Key Provider Information ("arn:aws:kms:ca-central-1:111122223333:key/9b13ca4b-afcc-46a8-aa47-be3435b423ff") 656E7472 616C2D31 3A313131 31323232 32333333 333A6B65 792F3962 31336361 34622D61 6663632D 34366138 2D616134 372D6265 33343335 62343233 6666 00A7 Encrypted Data Key 2, Encrypted Data Key Length (167) 01010200 78FAFFFB D6DE06AF AC72F79B Encrypted Data Key 2, Encrypted Data Key 0E57BD87 3F60F4E6 FD196144 5A002C94 AF787150 69000000 7E307C06 092A8648 86F70D01 0706A06F 306D0201 00306806 092A8648 86F70D01 0701301E 06096086 48016503 04012E30 11040CB2 A820D0CC 76616EF2 A6B30D02 0110803B 8073D0F1 FDD01BD9 B0979082 099FDBFC F7B13548 3CC686D7 F3CF7C7A CCC52639 122A1495 71F18A46 80E2C43F A34C0E58 11D05114 2A363C2A E11397 01 Content Type (1, non-framed data) 00000000 Reserved 0C IV Length (12) 00000000 Frame Length (0, non-framed data) 734C1BBE 032F7025 84CDA9D0 IV 2C82BB23 4CBF4AAB 8F5C6002 622E886C Authentication Tag +------+ | Body | +------+ D39DD3E5 915E0201 77A4AB11 IV 00000000 0000028E Encrypted Content Length (654) E8B6F955 B5F22FE4 FD890224 4E1D5155 Encrypted Content 5871BA4C 93F78436 1085E4F8 D61ECE28 59455BD8 D76479DF C28D2E0B BDB3D5D3 E4159DFE C8A944B6 685643FC EA24122B 6766ECD5 E3F54653 DF205D30 0081D2D8 55FCDA5B 9F5318BC F4265B06 2FE7C741 C7D75BCC 10F05EA5 0E2F2F40 47A60344 ECE10AA7 559AF633 9DE2C21B 12AC8087 95FE9C58 C65329D1 377C4CD7 EA103EC1 31E4F48A 9B1CC047 EE5A0719 704211E5 B48A2068 8060DF60 B492A737 21B0DB21 C9B21A10 371E6179 78FAFB0B BAAEC3F4 9D86E334 701E1442 EA5DA288 64485077 54C0C231 AD43571A B9071925 609A4E59 B8178484 7EB73A4F AAE46B26 F5B374B8 12B0000C 8429F504 936B2492 AAF47E94 A5BA804F 7F190927 5D2DF651 B59D4C2F A15D0551 DAEBA4AF 2060D0D5 CB1DA4E6 5E2034DB 4D19E7CD EEA6CF7E 549C86AC 46B2C979 AB84EE12 202FD6DF E7E3C09F C2394012 AF20A97E 369BCBDA 62459D3E C6FFB914 FEFD4DE5 88F5AFE1 98488557 1BABBAE4 BE55325E 4FB7E602 C1C04BEE F3CB6B86 71666C06 6BF74E1B 0F881F31 B731839B CF711F6A 84CA95F5 958D3B44 E3862DF6 338E02B5 C345CFF8 A31D54F3 6920AA76 0BF8E903 552C5A04 917CCD11 D4E5DF5C 491EE86B 20C33FE1 5D21F0AD 6932E67C C64B3A26 B8988B25 CFA33E2B 63490741 3AB79D60 D8AEFBE9 2F48E25A 978A019C FE49EE0A 0E96BF0D D6074DDB 66DFF333 0E10226F 0A1B219C BE54E4C2 2C15100C 6A2AA3F1 88251874 FDC94F6B 9247EF61 3E7B7E0D 29F3AD89 FA14A29C 76E08E9B 9ADCDF8C C886D4FD A69F6CB4 E24FDE26 3044C856 BF08F051 1ADAD329 C4A46A1E B5AB72FE 096041F1 F3F3571B 2EAFD9CB B9EB8B83 AE05885A 8F2D2793 1E3305D9 0C9E2294 E8AD7E3B 8E4DEC96 6276C5F1 A3B7E51E 422D365D E4C0259C 50715406 822D1682 80B0F2E5 5C94 65B2E942 24BEEA6E A513F918 CCEC1DE3 Authentication Tag +--------+ | Footer | +--------+ 0067 Signature Length (103) 30650230 7229DDF5 B86A5B64 54E4D627 Signature CBE194F1 1CC0F8CF D27B7F8B F50658C0 BE84B355 3CED1721 A0BE2A1B 8E3F449E 1BEB8281 023100B2 0CB323EF 58A4ACE3 1559963B 889F72C3 B15D1700 5FB26E61 331F3614 BC407CEE B86A66FA CBF74D9E 34CB7E4B 363A38

Framed Data

The following example shows the message format for framed data.

Copy
+--------+ | Header | +--------+ 01 Version (1.0) 80 Type (128, customer authenticated encrypted data) 0378 Algorithm ID (see Algorithms Reference) 6E7C0FBD 4DF4A999 717C22A2 DDFE1A27 Message ID (random 128-bit value) 008E AAD Length (142) 0004 AAD Key-Value Pair Count (4) 0005 AAD Key-Value Pair 1, Key Length (5) 30746869 73 AAD Key-Value Pair 1, Key ("0This") 0002 AAD Key-Value Pair 1, Value Length (2) 6973 AAD Key-Value Pair 1, Value ("is") 0003 AAD Key-Value Pair 2, Key Length (3) 31616E AAD Key-Value Pair 2, Key ("1an") 000A AAD Key-Value Pair 2, Value Length (10) 656E6372 79774690 6F6E AAD Key-Value Pair 2, Value ("encryption") 0008 AAD Key-Value Pair 3, Key Length (8) 32636F6E 74657874 AAD Key-Value Pair 3, Key ("2context") 0007 AAD Key-Value Pair 3, Value Length (7) 6578616D 706C65 AAD Key-Value Pair 3, Value ("example") 0015 AAD Key-Value Pair 4, Key Length (21) 6177732D 63727970 746F2D70 75626C69 AAD Key-Value Pair 4, Key ("aws-crypto-public-key") 632D6B65 79 0044 AAD Key-Value Pair 4, Value Length (68) 416A4173 7569326F 7430364C 4B77715A AAD Key-Value Pair 4, Value ("AjAsui2ot06LKwqZXDJnU/Aqc2vD+0OkpOZ1cc8Tg2qd7rs5aLTg7lvfUEW/86+/5w==") 58444A6E 552F4171 63327644 2B304F6B 704F5A31 63633854 67327164 37727335 614C5467 376C7666 5545572F 38362B2F 35773D3D 0002 EncryptedDataKeyCount (2) 0007 Encrypted Data Key 1, Key Provider ID Length (7) 6177732D 6B6D73 Encrypted Data Key 1, Key Provider ID ("aws-kms") 004B Encrypted Data Key 1, Key Provider Information Length (75) 61726E3A 6177733A 6B6D733A 75732D77 Encrypted Data Key 1, Key Provider Information ("arn:aws:kms:us-west-2:111122223333:key/715c0818-5825-4245-a755-138a6d9a11e6") 6573742D 323A3131 31313232 32323333 33333A6B 65792F37 31356330 3831382D 35383235 2D343234 352D6137 35352D31 33386136 64396131 316536 00A7 Encrypted Data Key 1, Encrypted Data Key Length (167) 01010200 7857A1C1 F7370545 4ECA7C83 Encrypted Data Key 1, Encrypted Data Key 956C4702 23DCE8D7 16C59679 973E3CED 02A4EF29 7F000000 7E307C06 092A8648 86F70D01 0706A06F 306D0201 00306806 092A8648 86F70D01 0701301E 06096086 48016503 04012E30 11040C3F F02C897B 7A12EB19 8BF2D802 0110803B 24003D1F A5474FBC 392360B5 CB9997E0 6A17DE4C A6BD7332 6BF86DAB 60D8CCB8 8295DBE9 4707E356 ADA3735A 7C52D778 B3135A47 9F224BF9 E67E87 0007 Encrypted Data Key 2, Key Provider ID Length (7) 6177732D 6B6D73 Encrypted Data Key 2, Key Provider ID ("aws-kms") 004E Encrypted Data Key 2, Key Provider Information Length (78) 61726E3A 6177733A 6B6D733A 63612D63 Encrypted Data Key 2, Key Provider Information ("arn:aws:kms:ca-central-1:111122223333:key/9b13ca4b-afcc-46a8-aa47-be3435b423ff") 656E7472 616C2D31 3A313131 31323232 32333333 333A6B65 792F3962 31336361 34622D61 6663632D 34366138 2D616134 372D6265 33343335 62343233 6666 00A7 Encrypted Data Key 2, Encrypted Data Key Length (167) 01010200 78FAFFFB D6DE06AF AC72F79B Encrypted Data Key 2, Encrypted Data Key 0E57BD87 3F60F4E6 FD196144 5A002C94 AF787150 69000000 7E307C06 092A8648 86F70D01 0706A06F 306D0201 00306806 092A8648 86F70D01 0701301E 06096086 48016503 04012E30 11040C36 CD985E12 D218B674 5BBC6102 0110803B 0320E3CD E470AA27 DEAB660B 3E0CE8E0 8B1A89E4 57DCC69B AAB1294F 21202C01 9A50D323 72EBAAFD E24E3ED8 7168E0FA DB40508F 556FBD58 9E621C 02 Content Type (2, framed data) 00000000 Reserved 0C IV Length (12) 00000100 Frame Length (256) 4ECBD5C0 9899CA65 923D2347 IV 0B896144 0CA27950 CA571201 4DA58029 Authentication Tag +------+ | Body | +------+ 00000001 Frame 1, Sequence Number (1) 6BD3FE9C ADBCB213 5B89E8F1 Frame 1, IV 1F6471E0 A51AF310 10FA9EF6 F0C76EDF Frame 1, Encrypted Content F5AFA33C 7D2E8C6C 9C5D5175 A212AF8E FBD9A0C3 C6E3FB59 C125DBF2 89AC7939 BDEE43A8 0F00F49E ACBBD8B2 1C785089 A90DB923 699A1495 C3B31B50 0A48A830 201E3AD9 1EA6DA14 7F6496DB 6BC104A4 DEB7F372 375ECB28 9BF84B6D 2863889F CB80A167 9C361C4B 5EC07438 7A4822B4 A7D9D2CC 5150D414 AF75F509 FCE118BD 6D1E798B AEBA4CDB AD009E5F 1A571B77 0041BC78 3E5F2F41 8AF157FD 461E959A BB732F27 D83DC36D CC9EBC05 00D87803 57F2BB80 066971C2 DEEA062F 4F36255D E866C042 E1382369 12E9926B BA40E2FC A820055F FB47E428 41876F14 3B6261D9 5262DB34 59F5D37E 76E46522 E8213640 04EE3CC5 379732B5 F56751FA 8E5F26AD Frame 1, Authentication Tag 00000002 Frame 2, Sequence Number (2) F1140984 FF25F943 959BE514 Frame 2, IV 216C7C6A 2234F395 F0D2D9B9 304670BF Frame 2, Encrypted Content A1042608 8A8BCB3F B58CF384 D72EC004 A41455B4 9A78BAC9 36E54E68 2709B7BD A884C1E1 705FF696 E540D297 446A8285 23DFEE28 E74B225A 732F2C0C 27C6BDA2 7597C901 65EF3502 546575D4 6D5EBF22 1FF787AB 2E38FD77 125D129C 43D44B96 778D7CEE 3C36625F FF3A985C 76F7D320 ED70B1F3 79729B47 E7D9B5FC 02FCE9F5 C8760D55 7779520A 81D54F9B EC45219D 95941F7E 5CBAEAC8 CEC13B62 1464757D AC65B6EF 08262D74 44670624 A3657F7F 2A57F1FD E7060503 AC37E197 2F297A84 DF1172C2 FA63CF54 E6E2B9B6 A86F582B 3B16F868 1BBC5E4D 0B6919B3 08D5ABCF FECDC4A4 8577F08B 99D766A1 E5545670 A61F0A3B A3E45A84 4D151493 63ECA38F Frame 2, Authentication Tag FFFFFFFF Final Frame, Sequence Number End 00000003 Final Frame, Sequence Number (3) 35F74F11 25410F01 DD9E04BF Final Frame, IV 0000008E Final Frame, Encrypted Content Length (142) F7A53D37 2F467237 6FBD0B57 D1DFE830 Final Frame, Encrypted Content B965AD1F A910AA5F 5EFFFFF4 BC7D431C BA9FA7C4 B25AF82E 64A04E3A A0915526 88859500 7096FABB 3ACAD32A 75CFED0C 4A4E52A3 8E41484D 270B7A0F ED61810C 3A043180 DF25E5C5 3676E449 0986557F C051AD55 A437F6BC 139E9E55 6199FD60 6ADC017D BA41CDA4 C9F17A83 3823F9EC B66B6A5A 80FDB433 8A48D6A4 21CB 811234FD 8D589683 51F6F39A 040B3E3B Final Frame, Authentication Tag +--------+ | Footer | +--------+ 0066 Signature Length (102) 30640230 085C1D3C 63424E15 B2244448 Signature 639AED00 F7624854 F8CF2203 D7198A28 758B309F 5EFD9D5D 2E07AD0B 467B8317 5208B133 02301DF7 2DFC877A 66838028 3C6A7D5E 4F8B894E 83D98E7C E350F424 7E06808D 0FE79002 E24422B9 98A0D130 A13762FF 844D