[cifs-protocol] [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 request fails with Invalid Parameter - TrackingID#2207110040008832

Jeff McCashland (He/him) jeffm at microsoft.com
Tue Jul 12 15:54:08 UTC 2022


Hi Andreas,

I plan to file a document update request and discuss these changes with our SAMR team. But first, I'd like to make sure we've got it working right. If you need to upload additional traces, please use the credentials below. 

The latest traces fail for the same reason as the previous traces. The server's calculated AuthData doesn't match the AuthData you provided. 

Passed AuthData:
 93 4d dd 68 8b 90 a5 e2 76 8f d1 6b a6 bd ba 96
 76 d7 6e c6 d4 a6 7a 2d 89 0f 4d 6c 15 b0 99 15
 48 55 37 3e 9c c7 9a c2 a2 06 95 78 00 af df 7c
 d1 d1 ad eb 2f 5b 3d 88 ad f9 52 8a 8f 3c 23 81

Calculated AuthData: 
 0e 2f e5 93 56 6f 00 11-99 d8 ed b0 6a 58 46 94
 15 84 4a 6b 3b df 47 03-38 8d fb 4d fd b0 04 21
 84 4a 53 4b 3f 46 91 8a-4c ea d7 1f c2 c7 ef 89
 68 f6 c3 6a a2 ea 4d 37-3c 69 77 9f 92 a2 3e 22

mac_key ::= HMAC-SHA-512(CEK, SAM_AES256_MAC_KEY_STRING)

CEK (UserSessionKey):
96 17 39 9c a7 54 9e 41-c4 79 71 4b a0 89 5b 0a 

SAM_AES256_MAC_KEY_STRING: "Microsoft SAM MAC key AEAD-AES-256-CBC-HMAC-SHA512 16"
 4d 69 63 72 6f 73 6f 66-74 20 53 41 4d 20 4d 41  Microsoft SAM MA
 43 20 6b 65 79 20 41 45-41 44 2d 41 45 53 2d 32  C key AEAD-AES-2
 35 36 2d 43 42 43 2d 48-4d 41 43 2d 53 48 41 35  56-CBC-HMAC-SHA5
 31 32 20 31 36 00                                12 16.

mac_key:
 8a 04 46 6d 5e e6 2d b8-32 9e ab be a4 8b 3f 6c
 3c 1c a1 aa b8 ec 9c 43-bc 4b 91 35 6f 3a c4 e2
 62 9b e8 12 63 73 94 2a-59 47 fc d8 78 5d 6d 68
 1b 9f 35 31 90 27 c8 ab-88 8d 80 ad 7b ea cd f5

AuthData ::= HMAC-SHA-512(mac_key, versionbyte + IV + Cipher + versionbyte_length)
Length of data to hash = 1 + 0x10 + 0x210 + 1 = 0x222

versionbyte: 
 01

IV (Salt):
 ac 9c ad cb 66 ed 2d 05 55 13 18 a9 a5 6b f9 6f

Cipher:
 9f aa c1 e7 40 ac 09 d0 c2 32 66 f6 ac bb 8a d1
 c9 78 22 d1 ae 91 14 79 40 5e de 20 6d f6 de e1
 09 fb 35 29 9d b5 40 d8 30 7e 5e 41 a9 21 01 9f
 64 fb 8f 73 61 4a b2 48 a2 05 53 cf c6 db 1e 64

 ca 14 3c 3b 59 01 00 bc d5 ae 5c c9 ae 54 64 43
 cd 50 0b 29 33 1f 10 99 83 9b c8 88 e4 d8 a7 ec
 1f f1 33 bc 6e c4 08 47 2e ce 01 15 90 ef 47 2b
 f0 d1 1f 31 67 db f8 65 2d aa e2 50 9f 66 67 3e

 40 87 b1 f5 4c f6 43 eb b8 de dc ff 09 e7 3c 44
 fb e4 7f e1 7a 1c 02 1a d1 9d 68 8f 55 ea 4e fc
 f3 a1 2a a0 1c 26 82 b2 94 29 3a 8c 91 89 bb 24
 23 da 84 85 0f 33 0f 69 a7 fa 52 57 d1 88 15 92

 30 6d 17 e6 c4 46 29 dc 0d fc 59 63 62 4b 96 be
 0c 98 b2 96 7f 02 f5 ae d7 40 83 a8 6d 0e b8 02
 f4 7c a1 70 45 eb 2f 39 9a 14 15 ea 2c 61 16 60
 c5 8d 1d f3 98 e5 f2 4b fe 5c db 76 b1 34 1b ce

 9b 81 b4 f1 fd 58 3c a1 a6 8f 33 3b d0 b0 6e 0d
 0f 7a 83 ef 0a 78 71 3d 1b 8d 21 64 c3 db 4f 38
 cf f4 25 99 79 ba 51 1e f1 c5 0d b4 78 2e e9 ea
 a3 65 73 e3 32 91 7c 39 1f 7b 3f 89 4f 86 f9 14

 1f d0 0e a6 aa fe 40 22 8e 50 1c 4c 0d e8 83 7e
 eb 7f 2c a5 d2 c4 93 db 00 1c 48 cf b6 18 2d ab
 92 88 de 35 bc fe 8a f2 a6 d2 02 e8 83 a9 6e 46
 d0 d8 f2 64 b8 3a ac bc bf ff 20 1d 61 46 70 22

 99 a3 7a f1 04 29 0d 5b c8 0e be 3f 23 12 53 4c
 50 27 11 ca ed 6c 9b 45 7a 5b 72 74 46 9f 5b 0a
 bf 75 49 be 4d 48 0e 3f 45 bb ae be a3 76 49 2a
 b5 de 05 36 df 0d 3d 4c 8d df 9f 04 d3 c7 96 bd

 cc 78 62 dc a0 23 2f 1a 81 e6 52 25 6f b0 79 e5
 75 88 c6 9e 10 49 70 4b 2b 57 3d 73 05 e9 5c a1
 57 f7 b0 7a 5a 6d e4 b7 dd 36 ba 91 41 ae 6c d7
 e2 ce 0c 21 e6 f6 1b 1c 76 cb 8e 30 c3 53 8e a5

 70 08 d1 9b 15 19 96 61 a8 fc 2f bc e2 7b bd 6a

versionbyte_length:
 01

File transfer credentials:
Log in as: 2207110040008832_andreas at dtmxfer.onmicrosoft.com
1-time: pv^YQ9[v

Workspace link: https://support.microsoft.com/files?workspace=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ3c2lkIjoiNTY5YjBlMTItMzYyNS00NjhlLWIwNjgtOTBiZDYyZDk2MTllIiwic3IiOiIyMjA3MTEwMDQwMDA4ODMyIiwiYXBwaWQiOiI0ZTc2ODkxZC04NDUwLTRlNWUtYmUzOC1lYTNiZDZlZjIxZTUiLCJzdiI6InYxIiwicnMiOiJFeHRlcm5hbCIsInd0aWQiOiJhYzUxMDFlOS1mMTExLTQ5MGUtOGVlYS04NWMxNGMyNzMyNmIiLCJpc3MiOiJodHRwczovL2FwaS5kdG1uZWJ1bGEubWljcm9zb2Z0LmNvbSIsImF1ZCI6Imh0dHA6Ly9zbWMiLCJleHAiOjE2NjU0MTQxMzEsIm5iZiI6MTY1NzYzODEzMX0.Oe0Nrl4WiClzTrLHTGeFVX6S-oHNH4LjSGoiVF9eXNo9wN9w-NyabVRaEUpWVvKheXcqukAuNYvxDGCnoj2ZbpPsE1JY4EByZfqC2l--8i6N0smD8Rtccd_YLg_hx9SqGO-Dgr6Y5zLo6FMBUnfF6xQ8jhqB5a7ZJf4-TfMnCgXDsltrLzB_JU1rLDsVGI5ZzZfN9BEOJeKxS9PJEB3azUy8lFvcMsyq8ZL5LOzyQyhg7H2CglwDjzNeGmg2Wov8vdVdh3Ahk0AZ08Otf7i-7tpggx0F9FsH13oS2j6IOzEni23z2G6AqNL4j7ss_23sCp5njIL70rvGv3LliynERA&wid=569b0e12-3625-468e-b068-90bd62d9619e

Best regards,
Jeff McCashland (He/him) | Senior Escalation Engineer | Microsoft Protocol Open Specifications Team 
Phone: +1 (425) 703-8300 x38300 | Hours: 9am-5pm | Time zone: (UTC-08:00) Pacific Time (US and Canada)
Local country phone number found here: http://support.microsoft.com/globalenglish | Extension 1138300

-----Original Message-----
From: Andreas Schneider <asn at samba.org> 
Sent: Monday, July 11, 2022 9:48 PM
To: Jeff McCashland (He/him) <jeffm at microsoft.com>
Cc: cifs-protocol at lists.samba.org; Jeff McCashland <jeffm at microsoftsupport.com>; Obaid Farooqi <obaidf at microsoft.com>
Subject: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 request fails with Invalid Parameter - TrackingID#2207110040008832

On Tuesday, July 12, 2022 2:45:09 AM CEST Jeff McCashland (He/him) wrote:
> [Subject and SR ID updated]
> 
> Hi Andreas,

Hi Jeff,
 
> We have created a new SR 2207110040008832 to track this new 
> investigation. I will analyze the traces and let you know what I find.

thank you very much. What do you think about the documentation changes suggested below?


Best regards


	Andreas


> Best regards,
> Jeff McCashland (He/him) | Senior Escalation Engineer | Microsoft Protocol
> Open Specifications Team Phone: +1 (425) 703-8300 x38300 | Hours: 9am-5pm |
> Time zone: (UTC-08:00) Pacific Time (US and Canada) Local country phone
> number found here: https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsupport.microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40microsoft.com%7Cb2ba2663ee284f05902008da63c1c866%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637931981216284830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3FhA%2B%2FZpH%2FGGg9HjJ3Rm93zfKAdW8ZSfr26uLy%2BoQ7M%3D&reserved=0 | Extension
> 1138300
> 
> -----Original Message-----
> From: Andreas Schneider <asn at samba.org>
> Sent: Monday, July 11, 2022 1:47 AM
> To: Jeff McCashland (He/him) <jeffm at microsoft.com>
> Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> <jeffm at microsoftsupport.com>; Obaid Farooqi <obaidf at microsoft.com> Subject:
> Re: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> TrackingID#2206210040006850
> On Friday, July 8, 2022 7:38:46 PM CEST Jeff McCashland (He/him) wrote:
> > Hi Andreas,
> > 
> > This time, the AuthData that you sent does not match the AuthData
> > calculated by the server. I've clarified the calculation below.
> 
> Hi Jeff,
> 
> thank you very much for those hex dumps! This allowed me to write some unit
> tests and actually figure out the issues I have in my implementation.
> 
> The documentations should clarify that in
> 
> 2.2.1.18 AEAD-AES-256-CBC-HMAC-SHA512 Constants
> 
> SAM_AES256_ENC_KEY_STRING_LENGTH | sizeof(SAM_AES256_ENC_KEY_STRING)
> 
> the terminating '\0' byte of the string is included! Same for the mac key.
> 
> 
> 
> In "3.2.2.4 AES Cipher Usage" it would be nice if it would mention for
> 
> Let enc_key ::= HMAC-SHA-512(CEK, SAM_AES256_ENC_KEY_STRING) Let mac_key ::=
> HMAC-SHA-512(CEK, SAM_AES256_MAC_KEY_STRING)
> 
> that only the first 32 bytes of the calculated 64 bytes are used of the
> enc_key and mac_key.
> 
> 
> 
> However I'm still getting STATUS_INVALID_PARAMETER. Could you please take
> another look? I've uploaded new traces (lsass05) after fixing my
> implementation. The hex dumps you provided were really useful!
> 
> **Thank you very much for your help Jeff!** This is much appreciated.
> 
> Best regards
> 
> 
> 	Andreas
> 
> > Passed AuthData:
> >  8f b6 dd 6c 6f a9 9a f9-ff 89 39 c5 e9 e0 02 fb
> >  fc c4 8c 03 71 ef 64 53-b8 41 ba 4f 7d a8 cc 9b
> >  d0 8f bf 5a e8 7b bf 82-e3 1b c6 24 4c d5 3a 39
> >  c5 ee a5 95 c3 9f ed a6-31 ed 8d a5 48 d2 da 93
> > 
> > Calculated AuthData:
> >  b3 81 fc 86 e4 60 e0 91-3c 1d 97 6e 4d 51 e7 a3
> >  a4 47 3f 90 f5 26 5a 29-8f d8 73 22 d7 0f 09 b8
> >  93 77 85 f2 e7 dd f7 e1-cc 21 30 2a 33 97 11 84
> >  fd 79 a3 e8 0c 4b 1f 43-dc 2a 7c cf cc 9d 3e 24
> > 
> > First, the MAC key is calculated using the formula:
> > mac_key ::= HMAC-SHA-512(CEK, SAM_AES256_MAC_KEY_STRING)
> > 
> > CEK = Session key:
> >  c9 b2 f0 3f bb 33 d4 d2-50 0b 79 4c d2 81 f9 53
> > 
> > SAM_AES256_MAC_KEY_STRING:
> > "Microsoft SAM MAC key AEAD-AES-256-CBC-HMAC-SHA512 16"
> > 
> > Resulting mac_key:
> >  11 76 94 44 e0 58 f1 a1-03 1f 8f 8e 8f 25 1e e1
> >  10 c2 11 90 90 c3 71 97-86 7c 10 61 c1 58 c4 9b
> >  79 53 11 0b fc 83 dd 90-12 dd ea 6d 92 7b 06 a7
> >  a0 a4 6d 7b ba 2e 90 e6-37 7f 93 39 60 ed 00 2b
> > 
> > Then, the mac_key is used to hash a concatenation of elements::
> > AuthData ::= HMAC-SHA-512(mac_key, versionbyte + IV + Cipher +
> > versionbyte_length)
> > 
> > Data to hash (all of the below in order, 0x222 bytes):
> > 
> > versionbyte:
> >  01
> > 
> > Salt (IV):
> >  0f 5e fb 7d 58 65 12 19 fb 77 23 d0 af 65 b7 2b
> > 
> > Cipher:
> > 50 a6 1b e7 ed 61 9f 3a-8e c1 5f 7b bb 1f e4 85
> > 
> >  17 17 93 e1 0d c2 b2 f4-4e 35 f1 2b 7b 66 9f fc
> >  df 8f 50 e5 3c 5d 3d ad-41 cd f5 9d 84 61 9b 34
> >  17 9c 31 8a 17 e7 cd 8f-90 3b dc 5c 2f 3b 69 32
> >  1f 17 7a 87 a4 70 66 56-47 72 71 5f 55 09 1c 16
> >  ac 71 c2 ad 83 77 9f 18-52 81 4b de ca 2c 6f b9
> >  a6 9f 54 22 fe 50 00 94-a4 e4 a3 b2 ea ed 02 44
> >  0e 38 73 d9 27 32 d4 f7-e7 5f 51 56 20 37 07 da
> >  
> >  d4 a6 58 43 0b f9 7e 51-8f 3c 9e 0a 89 cc 96 ee
> >  e3 60 26 a0 e7 e4 ae f6-4d e3 fe ad 67 58 2f 5c
> >  d8 77 f9 58 8a 7b 69 2a-65 75 8d 45 b2 f1 9f b3
> >  a4 4f c2 88 2c 50 64 2e-af 3d b2 e6 59 e4 20 fb
> >  88 62 31 be d0 56 14 90-15 71 4f 2f 8d 44 da 65
> >  c5 e2 67 9e 68 14 90 e7-83 3e 77 6c b3 4e 04 97
> >  10 e1 88 2a 00 3d dc c1-26 9e fa ca e8 24 42 8f
> >  1c f4 f5 7f d6 c6 d7 a4-ff cf 71 ad 0f 57 d8 af
> >  
> >  47 35 33 43 e2 9b bf 8e-71 35 bd 37 79 e0 72 01
> >  02 b9 80 1e 2d ba 86 82-c2 1a 67 03 fe e9 e5 45
> >  ce 9b ac 75 a3 ed 71 69-31 43 84 cb 4d 4c 07 34
> >  bf 91 77 dd aa ac bf 03-91 2a da 32 1a 1f 2c d5
> >  fe 0b 7f fd 58 b0 6f cb-12 97 ee 8e 0e fe 43 3a
> >  02 fb a1 72 a6 3b 96 a9-e6 70 2d a7 9e e1 5e 2f
> >  9c a8 bf e6 02 24 e6 c2-b1 9a be 6a f7 98 78 1d
> >  a8 47 2d c1 1c db ee 23-2e 2d 23 23 14 9b e8 a5
> >  
> >  9d 91 75 9c 59 05 60 23-d4 90 f3 b7 fc 5e 11 b4
> >  c1 5f 20 45 29 41 be a8-51 21 4f 04 0e 89 20 fa
> >  d7 07 2e e1 75 dd 61 24-b9 a7 74 42 35 9c 07 08
> >  ce 53 c3 dc b4 dd 14 67-77 d7 60 27 1b 2c 98 34
> >  3b ac 35 42 52 7f 34 90-1b ed d1 29 bc 63 7a 51
> >  8f 22 82 e5 da d4 50 5e-4c 6a 4d 11 f9 d4 19 ba
> >  2f ba 3b ab f3 65 43 72-8f 61 a9 0d c6 4e 16 b5
> >  89 be 2e 9b 34 2c c2 cb-50 23 60 85 ae 4b a2 cb
> >  
> >  4b 39 0c 14 41 01 81 95-68 ec 53 42 3d a8 30 4c
> > 
> > versionbyte_length:
> >  01
> > 
> > I hope that helps!
> > 
> > Best regards,
> > Jeff McCashland (He/him) | Senior Escalation Engineer | Microsoft Protocol
> > Open Specifications Team Phone: +1 (425) 703-8300 x38300 | Hours: 9am-5pm
> > |
> > Time zone: (UTC-08:00) Pacific Time (US and Canada) Local country phone
> > number found here:
> > https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsupport.
> > microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40microsoft.com%7C1
> > f03de7046854aa6756708da6319faa1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0
> > %7C637931260502671724%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi
> > V2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YqnESb45H
> > f%2BTZ8h%2BU9ggIMZHsaraTr3qKhkqHPsXmzs%3D&reserved=0 | Extension
> > 1138300
> > 
> > -----Original Message-----
> > From: Andreas Schneider <asn at samba.org>
> > Sent: Thursday, July 7, 2022 9:49 AM
> > To: Jeff McCashland (He/him) <jeffm at microsoft.com>
> > Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> > <jeffm at microsoftsupport.com>; Obaid Farooqi <obaidf at microsoft.com>
> > Subject:
> > Re: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> > TrackingID#2206210040006850
> > 
> > On Thursday, July 7, 2022 5:48:26 PM CEST Jeff McCashland (He/him) wrote:
> > > Hi Andreas,
> > 
> > > Please use these credentials for further traces:
> > Hi Jeff,
> > 
> > I've uploaded new traces.
> > 
> > 
> > Thank you very much for your help!
> > 
> > 	Andreas
> > 	
> > > Log in as: 2207060040005870_andreas at dtmxfer.onmicrosoft.com
> > > 1-time: 15jUOn1x
> > > 
> > > Workspace link:
> > > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsupp
> > > ort.microsoft.com%2Ffiles%3Fworkspace%3DeyJ0eXAiOiJKV1QiLCJhbGciOiJSU&
> > > amp;data=05%7C01%7Cjeffm%40microsoft.com%7C3f3b73b690cf494992d808da603
> > > 89ac8%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637928093491367492%
> > > 7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik
> > > 1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2BgNWdzW1%2B3sXcCWTznA
> > > ATYbmEBCDIgcLOLe%2BI1l%2F3Gc%3D&reserved=0
> > > zI1NiJ9.eyJ3c2lkIjoiYTBkYWUxODMtMzE4MC00NzUxLWEwMGYtZmFlYTYxNjljMGJmIi
> > > wic3Ii
> > > OiIyMjA3MDYwMDQwMDA1ODcwIiwiYXBwaWQiOiI0ZTc2ODkxZC04NDUwLTRlNWUtYmUzOC
> > > 1lYTNi
> > > ZDZlZjIxZTUiLCJzdiI6InYxIiwicnMiOiJFeHRlcm5hbCIsInd0aWQiOiJlMmEwODJhMi
> > > 03NWVm
> > > LTRmMzYtYTVmOC0yNzRhY2VlZGFlZDIiLCJpc3MiOiJodHRwczovL2FwaS5kdG1uZWJ1bG
> > > EubWlj
> > > cm9zb2Z0LmNvbSIsImF1ZCI6Imh0dHA6Ly9zbWMiLCJleHAiOjE2NjQ5ODQ4MjAsIm5iZi
> > > I6MTY1
> > > NzIwODgyMH0.b0IenmkDjptFJ926X3UKUw_sKX4G6KRXehmJJH8jxjFDRdw8y8fUu9yPOi
> > > yB50hB
> > > dnyFh2OW8Bp7z8nJHVS3n6JLpwbdtutawAoujgFtCxQuFc6tlA4mN5lyfo_vzdl1WbTVv8
> > > Qy_oRW
> > > _stATR0155pLj5Dveuo8NTeIm9PzZRmfxqGTYl-hc1IOeWWthy7l-tsZcpYJPcajp_xSoK
> > > LpDhxp
> > > Vhsg7stsqrP1gkU09mCcyInu2F7Nvaci5iLGxYdL9S02TJ7b8eVOxUFDDHVDQFUgXoPTou
> > > kVswUJ
> > > Nz-Ch7FhSoQc9pi06LdGQXKtWRqp86BjWtrS1RLCg0TK-LddrQ&wid=a0dae183-3180-4
> > > 751-a0
> > > 0f-faea6169c0bf
> > > 
> > > Best regards,
> > > Jeff McCashland (He/him) | Senior Escalation Engineer | Microsoft
> > > Protocol Open Specifications Team Phone: +1 (425) 703-8300 x38300 |
> > > Hours: 9am-5pm | Time zone: (UTC-08:00) Pacific Time (US and Canada)
> > > Local country phone number found here:
> > > https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsuppo
> > > rt.microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40microsoft.
> > > com%7C3f3b73b690cf494992d808da60389ac8%7C72f988bf86f141af91ab2d7cd011d
> > > b47%7C1%7C0%7C637928093491367492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL
> > > jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&
> > > amp;sdata=lW6mcMnxLHormqurabvYFLNsQxmzRXv6BRh6%2FbYzGQ4%3D&reserve
> > > d=0 | Extension
> > > 1138300
> > > 
> > > -----Original Message-----
> > > From: Andreas Schneider <asn at samba.org>
> > > Sent: Thursday, July 7, 2022 1:59 AM
> > > To: Jeff McCashland (He/him) <jeffm at microsoft.com>
> > > Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> > > <jeffm at microsoftsupport.com>; Obaid Farooqi <obaidf at microsoft.com>
> > > Subject:
> > > Re: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> > > TrackingID#2206210040006850
> > > 
> > > On Thursday, July 7, 2022 10:57:04 AM CEST Andreas Schneider wrote:
> > > > On Thursday, July 7, 2022 10:32:39 AM CEST Andreas Schneider wrote:
> > > > > On Tuesday, July 5, 2022 8:52:20 PM CEST Jeff McCashland (He/him)
> 
> wrote:
> > > > > > Hi Andreas,
> > > > > 
> > > > > Hi Jeff,
> > > > > 
> > > > > > The server is returning STATUS_INVALID_PARAMETER because it
> > > > > > appears the 'Cipher' is missing from the encrypted password
> > > > > > structure. I see the AuthData and Salt, and cbCipher = 0x210,
> > > > > > and I see PBKDF2Iterations = 0x20000, but no Cipher. What are
> > > > > > you intending to send?> >
> > > > > 
> > > > > I thought I found a bug, but there wasn't one. I was just lost in
> > > > > optimizations and debugger stepping.
> > > > > 
> > > > > Checking the NDR output I see the cipher data and if I look at the
> > > > > wireshark network trace, I can see SetUserInfo2 call sends 640
> > > > > bytes
> > > > > (528 bytes of it being the the cipher data). So there is
> > > > > definitely cipher data being sent over the wire!
> > > > > 
> > > > > Now the question is why don't you see the cipher on Windows (it is
> > > > > on the wire)?
> > > > 
> > > > Hi,
> > > > 
> > > > I found the issue, the cipher length should be a uint32 and I had a
> > > > uint64.
> > > > Because of this the cipher was NULL on Windows as it read the 0 byte
> > > > from the uint64 value. I fixed our IDL so it should be correct now.
> > > > 
> > > > I'm still getting STATUS_INVALID_PARAMETER
> > > > 
> > > > I've created new traces and uploaded it to the workspace.
> > > 
> > > Actually, the upload failed and I can't upload files anymore :-(
> > > 
> > > > Thanks for your help!
> > > > 
> > > > 
> > > > Cheers
> > > > 
> > > > 	Andreas
> > > > 	
> > > > > Best regards
> > > > > 
> > > > > 	Andreas
> > > > > 	
> > > > > > Best regards,
> > > > > > Jeff McCashland (He/him) | Senior Escalation Engineer |
> > > > > > Microsoft Protocol Open Specifications Team Phone: +1 (425)
> > > > > > 703-8300 x38300
> > > > > > 
> > > > > > | Hours:
> > > > > > 9am-5pm
> > > > > > 
> > > > > > Time zone: (UTC-08:00) Pacific Time (US and Canada) Local
> > > > > > country phone number found here:
> > > > > > https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2
> > > > > > Fs
> > > > > > upport.microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40
> > > > > > mi
> > > > > > crosoft.com%7C198055d218f0450c6bbd08da5ff6f80a%7C72f988bf86f141a
> > > > > > f9
> > > > > > 1ab2d7cd011db47%7C1%7C0%7C637927811583654516%7CUnknown%7CTWFpbGZ
> > > > > > sb
> > > > > > 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M
> > > > > > n0
> > > > > > %3D%7C3000%7C%7C%7C&sdata=MoAicQeAh7xWT4jqXRwBmP4FhQ58wB0GpM
> > > > > > V2
> > > > > > 1XmMTnk%3D&reserved=0 | Extension
> > > > > > 1138300
> > > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Jeff McCashland (He/him)
> > > > > > Sent: Thursday, June 30, 2022 11:35 AM
> > > > > > To: 'Andreas Schneider' <asn at samba.org>
> > > > > > Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> > > > > > <jeffm at microsoftsupport.com>; Obaid Farooqi
> > > > > > <obaidf at microsoft.com>
> > > > > > Subject:
> > > > > > RE: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> > > > > > TrackingID#2206210040006850
> > > > > > 
> > > > > > Thank you for the traces, Andreas!
> > > > > > 
> > > > > > I am analyzing them and sill let you know what I find.
> > > > > > 
> > > > > > Best regards,
> > > > > > Jeff McCashland (He/him) | Senior Escalation Engineer |
> > > > > > Microsoft Protocol Open Specifications Team Phone: +1 (425)
> > > > > > 703-8300 x38300
> > > > > > 
> > > > > > | Hours:
> > > > > > 9am-5pm
> > > > > > 
> > > > > > Time zone: (UTC-08:00) Pacific Time (US and Canada) Local
> > > > > > country phone number found here:
> > > > > > https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2
> > > > > > Fs
> > > > > > upport.microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40
> > > > > > mi
> > > > > > crosoft.com%7C198055d218f0450c6bbd08da5ff6f80a%7C72f988bf86f141a
> > > > > > f9
> > > > > > 1ab2d7cd011db47%7C1%7C0%7C637927811583654516%7CUnknown%7CTWFpbGZ
> > > > > > sb
> > > > > > 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M
> > > > > > n0
> > > > > > %3D%7C3000%7C%7C%7C&sdata=MoAicQeAh7xWT4jqXRwBmP4FhQ58wB0GpM
> > > > > > V2
> > > > > > 1XmMTnk%3D&reserved=0 | Extension
> > > > > > 1138300 We value your feedback.  My manager is Stacy Gray
> > > > > > (stacygr), +1
> > > > > > (469) 775-4055
> > > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Andreas Schneider <asn at samba.org>
> > > > > > Sent: Wednesday, June 29, 2022 11:58 PM
> > > > > > To: Jeff McCashland (He/him) <jeffm at microsoft.com>
> > > > > > Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> > > > > > <jeffm at microsoftsupport.com>; Obaid Farooqi
> > > > > > <obaidf at microsoft.com>
> > > > > > Subject:
> > > > > > Re: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> > > > > > TrackingID#2206210040006850
> > > > > > 
> > > > > > On Wednesday, June 29, 2022 7:44:30 PM CEST Jeff McCashland
> > > > > > (He/him)
> > > > 
> > > > wrote:
> > > > > > > Hi Andreas,
> > > > > > 
> > > > > > Hi Jeff,
> > > > > > 
> > > > > > > Thank you for the clarification. A better approach would be to
> > > > > > > determine why your Windows server is failing the operation. I
> > > > > > > would like to collect LSASS traces from your Windows Server
> > > > > > > for analysis. I think it would help if you use the test data
> > > > > > > for the trial run.
> > > > > > > 
> > > > > > > I have created a File Transfer workspace to exchange files
> > > > > > > related to this issue (credentials and link below). If you
> > > > > > > still have the instructions and tools from when I requested
> > > > > > > LSASS traces in March, you can use those. Otherwise, you can
> > > > > > > find 'PartnerTTDRecorder_x86_x64.zip'
> > > > > > > on the
> > > > > > > workspace for download.
> > > > > > 
> > > > > > I've created a time trace and a network capture and uploaded it
> > > > > > to the workspace.
> > > > > > 
> > > > > > ./bin/rpcclient ncacn_np:earth.milkyway.site
> > > > > > -U'Administrator%Secret007!'
> > > > > > -c 'setuserinfo2 bob 31 Pa$$w0rd at 2'
> > > > > > result was NT_STATUS_INVALID_PARAMETER
> > > > > > 
> > > > > > 
> > > > > > Best regards
> > > > > > 
> > > > > > 	Andreas
> > > > > > 	
> > > > > > > To collect the needed traces:
> > > > > > > 	1. From an elevated command prompt, execute: tasklist /FI
> > > > > > > 
> > > > > > > "IMAGENAME
> > > > > > 
> > > > > > eq
> > > > > > 
> > > > > > > lsass.exe" 2. Note the PID of the lsass process from the
> > > > > > > output of the above command. 3. Execute: C:\TTD\TTTracer.exe
> > > > > > > -attach PID, where PID is the number from above. 4. Wait for a
> > > > > > > little window to pop up in top left corner of your screen,
> > > > > > > titled "lsass01.run" 5. start a network trace on the Server
> > > > > > > side
> > > > > > > 
> > > > > > > 	6. Repro the attempted operation
> > > > > > > 	7. Stop the network trace and save it
> > > > > > > 	8. CAREFULLY: uncheck the checkbox next to "Tracing" in the
> > > > > > > 
> > > > > > > small
> > > > > > > 
> > > > > > > "lsass01.run" window. Do not close or exit the small window or
> > > > > > > you will need to reboot. 9. The TTTracer.exe process will
> > > > > > > generate a trace file, then print out the name and location of
> > > > > > > the file. Compress the *.run file into a .zip archive before
> > > > > > > uploading with the matching network trace.
> > > > > > > 
> > > > > > > Log in as: 2206210040006850_andreas at dtmxfer.onmicrosoft.com
> > > > > > > 1-time: [KOGh3 at j
> > > > > > > 
> > > > > > > Workspace link:
> > > > > > > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2
> > > > > > > F%
> > > > > > > 2Fsupp
> > > > > > > ort.microsoft.com%2Ffiles%3Fworkspace%3DeyJ0eXAiOiJKV1QiLCJhbG
> > > > > > > ci
> > > > > > > OiJSU&
> > > > > > > amp;data=05%7C01%7Cjeffm%40microsoft.com%7Cfa8e39bd37b6446ac5c
> > > > > > > d0
> > > > > > > 8da5a6
> > > > > > > 5e415%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C63792169091
> > > > > > > 96
> > > > > > > 06900%
> > > > > > > 7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC
> > > > > > > JB
> > > > > > > TiI6Ik
> > > > > > > 1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9TMTXc4f4tyHxWS
> > > > > > > Wc
> > > > > > > Mxxs%2
> > > > > > > F3k5Q1qy2mCH%2FulX%2F2Hmoc%3D&reserved=0
> > > > > > > zI1NiJ9.eyJ3c2lkIjoiM2I3YTRiZjUtMTVlNi00ZDQ3LWJlMzUtMzMyZGMwMj
> > > > > > > I0
> > > > > > > NWNjIi
> > > > > > > wic3Ii
> > > > > > > OiIyMjA2MjEwMDQwMDA2ODUwIiwiYXBwaWQiOiI0ZTc2ODkxZC04NDUwLTRlNW
> > > > > > > Ut
> > > > > > > YmUzOC
> > > > > > > 1lYTNi
> > > > > > > ZDZlZjIxZTUiLCJzdiI6InYxIiwicnMiOiJFeHRlcm5hbCIsInd0aWQiOiI5YW
> > > > > > > Zl
> > > > > > > NDk3Yi
> > > > > > > 01NzE1
> > > > > > > LTRiYWYtYmRkNS1mNTIzYzliODQ4ZmQiLCJpc3MiOiJodHRwczovL2FwaS5kdG
> > > > > > > 1u
> > > > > > > ZWJ1bG
> > > > > > > EubWlj
> > > > > > > cm9zb2Z0LmNvbSIsImF1ZCI6Imh0dHA6Ly9zbWMiLCJleHAiOjE2NjQzMDAyMj
> > > > > > > Us
> > > > > > > Im5iZi
> > > > > > > I6MTY1
> > > > > > > NjUyNDIyNX0.WUjcO-UT6NMWT3eR4TJkmmwzbiHQLyqeinUgX-DmvUuQo4UaiI
> > > > > > > PF
> > > > > > > rNPoTF
> > > > > > > N_czY2
> > > > > > > -ihGY3N3bwnIt5AcE5f4JaR2qyT81r691J79n-IZgo8TFkdJMW6XjtVoIUkgOG
> > > > > > > h-
> > > > > > > RkyDKC
> > > > > > > Ajhsj8
> > > > > > > p6ddgiL-7UbxX58a7RWvOH9Yu0NzQdW8KKnyEUcFgFGPo42Sqy1igpkqxqcyAV
> > > > > > > OK
> > > > > > > FYicPR
> > > > > > > f2ux39
> > > > > > > SdHeoa9ptL78XLFsIuvNFkh6c77U1iEoaV3eqjQSu1rNriwv73cyu3WRJ0-dEi
> > > > > > > ZD
> > > > > > > VpzHP7
> > > > > > > 1JfdCE
> > > > > > > lYBe8lDjmnEWPm0_99Iudoi4RjIgtclS4zdAS_X9efCBKkIeOA&wid=3b7a4bf
> > > > > > > 5-
> > > > > > > 15e6-4
> > > > > > > d47-be
> > > > > > > 35-332dc02245cc
> > > > > > > 
> > > > > > > Best regards,
> > > > > > > Jeff McCashland (He/him) | Senior Escalation Engineer |
> > > > > > > Microsoft Protocol Open Specifications Team Phone: +1 (425)
> > > > > > > 703-8300 x38300 |
> > > > > > > Hours: 9am-5pm | Time zone: (UTC-08:00) Pacific Time (US and
> > > > > > > Canada) Local country phone number found here:
> > > > > > > https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F
> > > > > > > %2
> > > > > > > Fsuppo
> > > > > > > rt.microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40mi
> > > > > > > crosof
> > > > > > > t.
> > > > > > > com%7Cfa8e39bd37b6446ac5cd08da5a65e415%7C72f988bf86f141af91ab2
> > > > > > > d7
> > > > > > > cd011d
> > > > > > > b47%7C1%7C0%7C637921690919606900%7CUnknown%7CTWFpbGZsb3d8eyJWI
> > > > > > > jo
> > > > > > > iMC4wL
> > > > > > > jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7
> > > > > > > C%
> > > > > > > 7C%7C&
> > > > > > > amp;sdata=4fzxN9WyH8b16aKQOc7UbxtoMFPSo3CDa6JysWq%2BhKw%3D&amp
> > > > > > > ;r
> > > > > > > eserve
> > > > > > > d=0 | Extension
> > > > > > > 1138300 We value your feedback.  My manager is Stacy Gray
> > > > > > > (stacygr),
> > > > > > > +1
> > > > > > > (469) 775-4055
> > > > > > > 
> > > > > > > -----Original Message-----
> > > > > > > From: Andreas Schneider <asn at samba.org>
> > > > > > > Sent: Wednesday, June 29, 2022 7:24 AM
> > > > > > > To: Jeff McCashland (He/him) <jeffm at microsoft.com>
> > > > > > > Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> > > > > > > <jeffm at microsoftsupport.com>; Obaid Farooqi
> > > > > > > <obaidf at microsoft.com>
> > > > > > > Subject:
> > > > > > > Re: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> > > > > > > TrackingID#2206210040006850
> > > > > > > 
> > > > > > > On Tuesday, June 28, 2022 6:41:40 PM CEST Jeff McCashland
> > > > > > > (He/him)
> > > > 
> > > > wrote:
> > > > > > > > Hi Andreas,
> > > > > > > 
> > > > > > > Hi Jeff,
> > > > > > > 
> > > > > > > > Can you not use the test data provided in the RFC [AEX-CBC]
> > > > > > > > that you originally referenced?
> > > > > > > 
> > > > > > > I have an implementation of AEAD-AES-256-CBC-HMAC-SHA512 and
> > > > > > > implemented it in rpcclient, but it doesn't work against a
> > > > > > > Windows server. There are so many little details which can be
> > > > > > > different.
> > > > > > > 
> > > > > > > ./bin/rpcclient ncacn_np:earth.milkyway.site
> > > > > > > -U'Administrator%Secret007!' -c
> > > > > > > 'setuserinfo2 bob 31 Pa$$w0rd at 2'
> > > > > > > 
> > > > > > > 
> > > > > > > From MS-SAMR 3.2.2.4 AES Cipher Usage
> > > > > > > 
> > > > > > > ================
> > > > > > > 
> > > > > > > The data MUST be encrypted and decrypted using
> > > > > > > 
> > > > > > > AEAD-AES-256-CBC-HMAC-SHA512 as follows:
> > > > > > >     Let IV be a random 16-byte number.
> > > > > > >     
> > > > > > >     Then the encryption is done as follows:
> > > > > > >     
> > > > > > >     Let enc_key ::= HMAC-SHA-512(CEK,
> > > > > > > 
> > > > > > > SAM_AES256_ENC_KEY_STRING)
> > > > > > > 
> > > > > > >     Let mac_key ::= HMAC-SHA-512(CEK,
> > > > > > > 
> > > > > > > SAM_AES256_MAC_KEY_STRING)
> > > > > > > 
> > > > > > >     Let Cipher ::= AES-CBC(enc_key, IV, secret_plaintext)
> > > > > > >     
> > > > > > >     Let AuthData ::= HMAC-SHA-512(mac_key, versionbyte + IV +
> > > > > > > 
> > > > > > > Cipher +
> > > > > > > 
> > > > > > > versionbyte_length)
> > > > > > > 
> > > > > > > ================
> > > > > > > 
> > > > > > > As my implementation doesn't work against Windows it can be
> > > > > > > that my size of SAM_AES256_ENC_KEY_STRING is wrong.
> > > > > > > 
> > > > > > > 2.2.1.18 has:
> > > > > > >     SAM_AES256_ENC_KEY_STRING_LENGTH
> > > > > > > 
> > > > > > > sizeof(SAM_AES256_ENC_KEY_STRING)
> > > > > > > 
> > > > > > > The sizeof() in C would include the \0 terminator of a string,
> > > > > > > however I think that actually strlen() is meant.
> > > > > > > 
> > > > > > > Same for the mac key ...
> > > > > > > 
> > > > > > > Also there is truncation of keys happening. Like the enc_key
> > > > > > > is truncated to
> > > > > > > 32 bytes.
> > > > > > > 
> > > > > > > For calculating the authdata it isn't clear what data type
> > > > > > > versionbyte_length is. I would guess it is uint8_t but it
> > > > > > > could also be uint32_t ...
> > > > > > > 
> > > > > > > Is the AuthData truncated to 32 byte? In the RFC it is, but in
> > > > > > > MS-SAMR
> > > > > > > 2.2.6.32 the struct member for AuthData is 64 bytes. If
> > > > > > > truncation is happening will the rest be filled with 0 bytes?
> > > > > > > 
> > > > > > > Either I provide you the all unclear details and you figure it
> > > > > > > out for me.
> > > > > > > Or you provide the hexdumps and I figure it out and ask better
> > > > > > > questions
> > > > > > > 
> > > > > > > :-)
> > > > > > > 
> > > > > > > Here is some pseudo C code of my implementation:
> > > > > > > 
> > > > > > > #define SAMR_AES_VERSION_BYTE 0x01 #define
> > > > > > > SAMR_AES_VERSION_BYTE_LEN 1
> > > > > > > 
> > > > > > > #define SAMR_AES256_ENC_KEY_STRING \
> > > > > > > 
> > > > > > >         "Microsoft SAM encryption key
> > > > > > >         AEAD-AES-256-CBC-HMAC-SHA512
> > > > > > >         16"
> > > > > > > 
> > > > > > > #define SAMR_AES256_ENC_KEY_STRING_LEN 60
> > > > > > > 
> > > > > > > #define SAMR_AES256_MAC_KEY_STRING \
> > > > > > > 
> > > > > > >          "Microsoft SAM MAC key AEAD-AES-256-CBC-HMAC-SHA512 16"
> > > > > > > 
> > > > > > > #define SAMR_AES256_MAC_KEY_STRING_LEN 53
> > > > > > > 
> > > > > > > uint8_t version_byte = SAMR_AES_VERSION_BYTE; /* 0x01 */
> > > > > > > uint8_t version_byte_len = SAMR_AES_VERSION_BYTE_LEN; /* 1 */
> > > > > > > 
> > > > > > > uint8_t enc_key_data[64];
> > > > > > > uint8_t mac_key_data[64];
> > > > > > > 
> > > > > > > /* Calculate encryption key */
> > > > > > > /* cek_key is just 16 bytes if a SMB session key is used? */
> > > > > > > rc = gnutls_hmac_fast(GNUTLS_MAC_SHA512,
> > > > > > > 
> > > > > > >                       cek_key.data,
> > > > > > >                       cek_key.size,
> > > > > > >                       SAMR_AES256_ENC_KEY_STRING,
> > > > > > >                       SAMR_AES256_ENC_KEY_STRING_LEN,
> > > > > > >                       enc_key_data);
> > > > > > > 
> > > > > > > enc_key.data = mac_key_data;
> > > > > > > enc_key.size = 32; /* truncation from 64 to 32 bytes */
> > > > > > > 
> > > > > > > /* Encrypt plaintext */
> > > > > > > rc = gnutls_cipher_init(&cipher_hnd,
> > > > > > > 
> > > > > > >                         GNUTLS_CIPHER_AES_256_CBC,
> > > > > > >                         &enc_key,
> > > > > > >                         &iv);
> > > > > > > 
> > > > > > > rc = gnutls_cipher_encrypt2(cipher_hnd,
> > > > > > > 
> > > > > > >                             secret->data,
> > > > > > >                             secret->length,
> > > > > > >                             ctext,
> > > > > > >                             ctext_len);
> > > > > > > 
> > > > > > > /* Calculate mac key */
> > > > > > > rc = gnutls_hmac_fast(GNUTLS_MAC_SHA512,
> > > > > > > 
> > > > > > >                       cek_key.data,
> > > > > > >                       cek_key.size,
> > > > > > >                       SAMR_AES256_MAC_KEY_STRING,
> > > > > > >                       SAMR_AES256_MAC_KEY_STRING_LEN,
> > > > > > >                       mac_key_data);
> > > > > > > 
> > > > > > > mac_key.data = mac_key_data;
> > > > > > > mac_key.size = 32; /* truncation from 64 to 32 bytes */
> > > > > > > 
> > > > > > > /* Generate auth tag */
> > > > > > > rc = gnutls_hmac_init(&hmac_hnd,
> > > > > > > 
> > > > > > >                       GNUTLS_MAC_SHA512,
> > > > > > >                       mac_key.data,
> > > > > > >                       mac_key.size);
> > > > > > > 
> > > > > > > rc = gnutls_hmac(hmac_hnd,
> > > > > > > 
> > > > > > >                  &version_byte,
> > > > > > >                  sizeof(uint8_t));
> > > > > > > 
> > > > > > > rc = gnutls_hmac(hmac_hnd,
> > > > > > > 
> > > > > > >                  iv.data,
> > > > > > >                  iv.size);
> > > > > > > 
> > > > > > > rc = gnutls_hmac(hmac_hnd,
> > > > > > > 
> > > > > > >                  ctext,
> > > > > > >                  ctext_len);
> > > > > > > 
> > > > > > > rc = gnutls_hmac(hmac_hnd,
> > > > > > > 
> > > > > > >                  &version_byte_len,
> > > > > > >                  sizeof(uint8_t));
> > > > > > > 
> > > > > > > gnutls_hmac_deinit(hmac_hnd, auth_data);
> > > > > > > /* Is auth_data truncated? */
> > > > > > > 
> > > > > > > 
> > > > > > > Best regards
> > > > > > > 
> > > > > > > 	Andreas
> > > > > > > 	
> > > > > > > > It appears to have all or most of what you're looking for:
> > > > > > > > K (secret input key)
> > > > > > > > MAC_KEY
> > > > > > > > ENC_KEY
> > > > > > > > P (plaintext)
> > > > > > > > IV (initialization vector)
> > > > > > > > A (associated data)
> > > > > > > > PS (padding string)
> > > > > > > > AL (associated data length)
> > > > > > > > S (ciphertext - intermediate) T (authentication tag) C
> > > > > > > > (ciphertext)
> > > > > > > > 
> > > > > > > > Best regards,
> > > > > > > > Jeff McCashland (He/him) | Senior Escalation Engineer |
> > > > > > > > Microsoft Protocol Open Specifications Team Phone: +1 (425)
> > > > > > > > 703-8300 x38300 |
> > > > > > > > Hours: 9am-5pm
> > > > > > > > 
> > > > > > > > Time zone: (UTC-08:00) Pacific Time (US and Canada) Local
> > > > > > > > country phone number found here:
> > > > > > > > https://nam06.safelinks.protection.outlook.com/?url=http%3A%
> > > > > > > > 2F
> > > > > > > > %2Fsup
> > > > > > > > po
> > > > > > > > rt
> > > > > > > > .
> > > > > > > > microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40mic
> > > > > > > > ro
> > > > > > > > soft.c
> > > > > > > > om%7C2
> > > > > > > > aef7356a401488aa28b08da59db101c%7C72f988bf86f141af91ab2d7cd0
> > > > > > > > 11
> > > > > > > > db47%7
> > > > > > > > C1%7C0
> > > > > > > > %7C637921094670609275%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj
> > > > > > > > Aw
> > > > > > > > MDAiLC
> > > > > > > > JQIjoi
> > > > > > > > V2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&s
> > > > > > > > da
> > > > > > > > ta=3F5
> > > > > > > > A%2B2t
> > > > > > > > LvyvS8LOk%2FOx6BeqCckryLWLucxcaxKPNoCI%3D&reserved=0 |
> > > > > > > > Extension
> > > > > > > > 1138300 We value your feedback.  My manager is Stacy Gray
> > > > > > > > (stacygr),
> > > > > > > > +1
> > > > > > > > (469) 775-4055
> > > > > > > > 
> > > > > > > > -----Original Message-----
> > > > > > > > From: Jeff McCashland (He/him)
> > > > > > > > Sent: Monday, June 27, 2022 11:55 AM
> > > > > > > > To: Andreas Schneider <asn at samba.org>
> > > > > > > > Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> > > > > > > > <jeffm at microsoftsupport.com>; Obaid Farooqi
> > > > > > > > <obaidf at microsoft.com>
> > > > > > > > Subject:
> > > > > > > > RE: [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> > > > > > > > TrackingID#2206210040006850
> > > > > > > > 
> > > > > > > > Hi Andreas,
> > > > > > > > 
> > > > > > > > Our plan is to capture traffic where
> > > > > > > > AEAD-AES-256-CBC-HMAC-SHA512 is used.
> > > > > > > > 
> > > > > > > > We're working on setting up a Windows repro. However,
> > > > > > > > Windows uses LDAP instead of SAMR, so we're working out how
> > > > > > > > to configure it to use SAMR.
> > > > > > > > 
> > > > > > > > I'll keep you posted.
> > > > > > > > 
> > > > > > > > Best regards,
> > > > > > > > Jeff McCashland (He/him) | Senior Escalation Engineer |
> > > > > > > > Microsoft Protocol Open Specifications Team Phone: +1 (425)
> > > > > > > > 703-8300 x38300 |
> > > > > > > > Hours: 9am-5pm
> > > > > > > > 
> > > > > > > > Time zone: (UTC-08:00) Pacific Time (US and Canada) Local
> > > > > > > > country phone number found here:
> > > > > > > > https://nam06.safelinks.protection.outlook.com/?url=http%3A%
> > > > > > > > 2F
> > > > > > > > %2Fsup
> > > > > > > > po
> > > > > > > > rt
> > > > > > > > .
> > > > > > > > microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%40mic
> > > > > > > > ro
> > > > > > > > soft.c
> > > > > > > > om%7C2
> > > > > > > > aef7356a401488aa28b08da59db101c%7C72f988bf86f141af91ab2d7cd0
> > > > > > > > 11
> > > > > > > > db47%7
> > > > > > > > C1%7C0
> > > > > > > > %7C637921094670614268%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj
> > > > > > > > Aw
> > > > > > > > MDAiLC
> > > > > > > > JQIjoi
> > > > > > > > V2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&s
> > > > > > > > da
> > > > > > > > ta=u4W
> > > > > > > > bTdU%2
> > > > > > > > F6GSFcjspR21MPDStD8Ag2dtpPeNJ5nEgFH8%3D&reserved=0 |
> > > > > > > > Extension
> > > > > > > > 1138300 We value your feedback.  My manager is Stacy Gray
> > > > > > > > (stacygr),
> > > > > > > > +1 (469)
> > > > > > > > 775-4055
> > > > > > > > 
> > > > > > > > -----Original Message-----
> > > > > > > > From: Andreas Schneider <asn at samba.org>
> > > > > > > > Sent: Monday, June 27, 2022 4:56 AM
> > > > > > > > To: Jeff McCashland (He/him) <jeffm at microsoft.com>
> > > > > > > > Cc: cifs-protocol at lists.samba.org; Jeff McCashland
> > > > > > > > <jeffm at microsoftsupport.com>; Obaid Farooqi
> > > > > > > > <obaidf at microsoft.com>
> > > > > > > > Subject:
> > > > > > > > [EXTERNAL] Re: [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512 -
> > > > > > > > TrackingID#2206210040006850
> > > > > > > > 
> > > > > > > > On Wednesday, June 22, 2022 8:09:34 PM CEST Jeff McCashland
> > > > > > > > (He/him)
> > > > > > 
> > > > > > wrote:
> > > > > > > > > Hi Andreas,
> > > > > > > > 
> > > > > > > > Hi Jeff,
> > > > > > > > 
> > > > > > > > > I will research your question and see what we can come up
> > > > > > > > > with for test data.
> > > > > > > > 
> > > > > > > > thank you very much. Looking forward to hear from you :-)
> > > > > > > > 
> > > > > > > > 	Andreas
> > > > > > > > 	
> > > > > > > > > Best regards,
> > > > > > > > > Jeff McCashland (He/him) | Senior Escalation Engineer |
> > > > > > > > > Microsoft Protocol Open Specifications Team Phone: +1
> > > > > > > > > (425)
> > > > > > > > > 703-8300 x38300
> > > > > > > > > 
> > > > > > > > > Hours: 9am-5pm | Time zone: (UTC-08:00) Pacific Time (US
> > > > > > > > > and
> > > > > > > > > Canada) Local country phone number found here:
> > > > > > > > > https://nam06.safelinks.protection.outlook.com/?url=http%3
> > > > > > > > > A%
> > > > > > > > > 2F%2Fs
> > > > > > > > > uppo
> > > > > > > > > rt.microsoft.com%2Fglobalenglish&data=05%7C01%7Cjeffm%
> > > > > > > > > 40
> > > > > > > > > micros
> > > > > > > > > of
> > > > > > > > > t.
> > > > > > > > > com%7Cb133cf48cfa147d4956b08da5833fc38%7C72f988bf86f141af9
> > > > > > > > > 1a
> > > > > > > > > b2d7cd
> > > > > > > > > 011d
> > > > > > > > > b47%7C1%7C0%7C637919277699900369%7CUnknown%7CTWFpbGZsb3d8e
> > > > > > > > > yJ
> > > > > > > > > WIjoiM
> > > > > > > > > C4wL
> > > > > > > > > jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C30
> > > > > > > > > 00
> > > > > > > > > %7C%7C
> > > > > > > > > %7C&
> > > > > > > > > amp;sdata=%2BJdN4TiV%2Bvqq4dqYGpq7mGhZ1vh3gQrrvgjqsBuBXbg%
> > > > > > > > > 3D
> > > > > > > > > &r
> > > > > > > > > eser
> > > > > > > > > ved=0 | Extension
> > > > > > > > > 1138300 We value your feedback.  My manager is Stacy Gray
> > > > > > > > > (stacygr),
> > > > > > > > > +1
> > > > > > > > > (469) 775-4055
> > > > > > > > > 
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Obaid Farooqi <obaidf at microsoft.com>
> > > > > > > > > Sent: Tuesday, June 21, 2022 9:08 AM
> > > > > > > > > To: Andreas Schneider <asn at samba.org>
> > > > > > > > > Cc: cifs-protocol at lists.samba.org; Obaid Farooqi
> > > > > > > > > <obaidf at microsoftsupport.com> Subject: [EXTERNAL]
> > > > > > > > > [MS-SAMR]
> > > > > > > > > AEAD-AES-256-CBC-HMAC-SHA512 - TrackingID#2206210040006850
> > > > > > > > > 
> > > > > > > > > Hi Andreas:
> > > > > > > > > Thanks for contacting Microsoft. I have created a case to
> > > > > > > > > track this issue.
> > > > > > > > > A member of the open specifications team will be in touch
> > > > > > > > > soon.
> > > > > > > > > 
> > > > > > > > > Regards,
> > > > > > > > > Obaid Farooqi
> > > > > > > > > Escalation Engineer | Microsoft
> > > > > > > > > 
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Andreas Schneider <asn at samba.org>
> > > > > > > > > Sent: Tuesday, June 21, 2022 8:00 AM
> > > > > > > > > To: Interoperability Documentation Help
> > > > > > > > > <dochelp at microsoft.com>
> > > > > > > > > Cc: cifs-protocol at lists.samba.org
> > > > > > > > > Subject: [EXTERNAL] [MS-SAMR] AEAD-AES-256-CBC-HMAC-SHA512
> > > > > > > > > 
> > > > > > > > > Hello Dochelp,
> > > > > > > > > 
> > > > > > > > > I'm trying to implement support for
> > > > > > > > > AEAD-AES-256-CBC-HMAC-SHA512 from
> > > > > > > > > [MS- SAMR] 3.2.2.4 AES Cipher Usage.
> > > > > > > > > 
> > > > > > > > > This is not really easy as there are some details unclear.
> > > > > > > > > I would love to write a unit test for
> > > > > > > > > AEAD-AES-256-CBC-HMAC-SHA512.
> > > > > > > > > 
> > > > > > > > > Could you please provide hexdump of the buffers used in
> > > > > > > > > encryption from a
> > > > > > > > > SamrSetInformationUser2 level 31 from a test platform.
> > > > > > > > > 
> > > > > > > > > When it performs the following:
> > > > > > > > > 
> > > > > > > > > Let enc_key ::= HMAC-SHA-512(CEK,
> > > > > > > > > SAM_AES256_ENC_KEY_STRING) Let mac_key ::=
> > > > > > > > > HMAC-SHA-512(CEK, SAM_AES256_MAC_KEY_STRING) Let Cipher
> > > > > > > > > 
> > > > > > > > > ::= AES-CBC(enc_key, IV, secret_plaintext) Let AuthData
> > > > > > > > > ::=
> > > > > > > > > 
> > > > > > > > > HMAC-SHA-512(mac_key, versionbyte + IV + Cipher +
> > > > > > > > > versionbyte_length)
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > I would like to have hexdumps of the following buffers:
> > > > > > > > > 
> > > > > > > > > * cek (16byte sesssion key)
> > > > > > > > > * enc_key
> > > > > > > > > * mac_key
> > > > > > > > > * IV
> > > > > > > > > * secret_plaintext
> > > > > > > > > * cipher
> > > > > > > > > * authdata
> > > > > > > > > 
> > > > > > > > > The RFC implementation provides something like that, see:
> > > > > > > > > https://nam06.safelinks.protection.outlook.com/?url=https%
> > > > > > > > > 3A
> > > > > > > > > %2F%2F
> > > > > > > > > tool
> > > > > > > > > s.ietf%2F&data=05%7C01%7Cjeffm%40microsoft.com%7Cb133c
> > > > > > > > > f4
> > > > > > > > > 8cfa14
> > > > > > > > > 7d49
> > > > > > > > > 56b08da5833fc38%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0
> > > > > > > > > %7
> > > > > > > > > C63791
> > > > > > > > > 9277
> > > > > > > > > 699900369%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQ
> > > > > > > > > Ij
> > > > > > > > > oiV2lu
> > > > > > > > > MzIi
> > > > > > > > > LCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=i
> > > > > > > > > hs
> > > > > > > > > J1PYjg
> > > > > > > > > 2cT7
> > > > > > > > > 4D3zmlfdDV3UEVNtpJeOX%2BPWQYmg%2FI%3D&reserved=0
> > > > > > > > > .org%2Fid%2Fdraft-mcgrew-aead-aes-cbc-hmac-sha2-03.html%23
> > > > > > > > > rf
> > > > > > > > > c.sect
> > > > > > > > > io
> > > > > > > > > n.
> > > > > > > > > 5.4&am
> > > > > > > > > p;data=05%7C01%7Cjeffm%40microsoft.com%7C382019859d9f4eb7c
> > > > > > > > > c1
> > > > > > > > > b08da5
> > > > > > > > > 3a03
> > > > > > > > > c24%7C
> > > > > > > > > 72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637914244951310
> > > > > > > > > 82
> > > > > > > > > 0%7CUn
> > > > > > > > > know
> > > > > > > > > n%7CTW
> > > > > > > > > FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1h
> > > > > > > > > aW
> > > > > > > > > wiLCJX
> > > > > > > > > VCI6
> > > > > > > > > Mn0%3D
> > > > > > > > > %7C3000%7C%7C%7C&sdata=jzVMJ8GS%2BP30uF6pHSTfJf8ioOzDO
> > > > > > > > > K6
> > > > > > > > > 9Y%2By
> > > > > > > > > yFKD
> > > > > > > > > zpKo%3
> > > > > > > > > D&reserved=0
> > > > > > > > > 
> > > > > > > > > This would allow me to write a unit test and figure out
> > > > > > > > > the details what in my implementation something goes
> > > > > > > > > wrong. I can then provide feedback to improve the
> > > > > > > > > documentation.
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Thank you very much!
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Best regards
> > > > > > > > > 
> > > > > > > > >         Andreas Schneider
> > > > > > > > > 
> > > > > > > > > --
> > > > > > > > > Andreas Schneider                      asn at samba.org
> > > > > > > > > Samba Team
> > > > > > > > > https://nam06.safelinks.protection.outlook.com/?url=http%3
> > > > > > > > > A%
> > > > > > > > > 2F%2Fw
> > > > > > > > > ww.sam%2F&data=05%7C01%7Cjeffm%40microsoft.com%7Cfa8e3
> > > > > > > > > 9b
> > > > > > > > > d37b64
> > > > > > > > > 46ac5cd08da5a65e415%7C72f988bf86f141af91ab2d7cd011db47%7C1
> > > > > > > > > %7
> > > > > > > > > C0%7C6
> > > > > > > > > 37921690919606900%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> > > > > > > > > MD
> > > > > > > > > AiLCJQ
> > > > > > > > > IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C
> > > > > > > > > &a
> > > > > > > > > mp;sda
> > > > > > > > > ta=gf3Xowal5D7zYZ5e26Z78ZLQNoea1hoWed09vWMnkxA%3D&rese
> > > > > > > > > rv
> > > > > > > > > ed=0
> > > > > > > > > ba%2F&data=05%7C01%7Cjeffm%40microsoft.com%7C2aef7356a
> > > > > > > > > 40
> > > > > > > > > 1488aa
> > > > > > > > > 28b08d
> > > > > > > > > a59db101c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637
> > > > > > > > > 92
> > > > > > > > > 109467
> > > > > > > > > 061926
> > > > > > > > > 7%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2lu
> > > > > > > > > Mz
> > > > > > > > > IiLCJB
> > > > > > > > > TiI6Ik
> > > > > > > > > 1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=UWJ4c8%2BpO
> > > > > > > > > SJ
> > > > > > > > > 8UiaN%
> > > > > > > > > 2FeH7l
> > > > > > > > > marEwwyiVx1ECnPk03Awk4%3D&reserved=0
> > > > > > > > > %2F&data=05%7C01%7Cjeffm%40microsoft.com%7Cb133cf48cfa
> > > > > > > > > 14
> > > > > > > > > 7d4956
> > > > > > > > > b08da
> > > > > > > > > 583
> > > > > > > > > 3fc38%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6379192
> > > > > > > > > 77
> > > > > > > > > 699900
> > > > > > > > > 369%7
> > > > > > > > > CUn
> > > > > > > > > known%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC
> > > > > > > > > JB
> > > > > > > > > TiI6Ik
> > > > > > > > > 1haWw
> > > > > > > > > iLC
> > > > > > > > > JXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Q04le03I8jml11uEltl
> > > > > > > > > zI
> > > > > > > > > ssEEkp
> > > > > > > > > VMfFe
> > > > > > > > > HjD Ydw2cPIU%3D&reserved=0.
> > > > > > > > > org%2F&data=05%7C01%7Cjeffm%40microsoft.com%7C38201985
> > > > > > > > > 9d
> > > > > > > > > 9f4eb7
> > > > > > > > > cc1b
> > > > > > > > > 08da53
> > > > > > > > > a03c24%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637914
> > > > > > > > > 24
> > > > > > > > > 495131
> > > > > > > > > 0820
> > > > > > > > > %7CUnk
> > > > > > > > > nown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ
> > > > > > > > > BT
> > > > > > > > > iI6Ik1
> > > > > > > > > haWw
> > > > > > > > > iLCJXV
> > > > > > > > > CI6Mn0%3D%7C3000%7C%7C%7C&sdata=0VU8ycMe9EFGOAEV7JROkm
> > > > > > > > > RR
> > > > > > > > > oQCDje
> > > > > > > > > 5N%2Fx
> > > > > > > > > AI
> > > > > > > > > bz qpbI4%3D&reserved=0 GPG-ID:
> > > > > > > > > 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D


-- 
Andreas Schneider                      asn at samba.org
Samba Team                             https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.samba.org%2F&data=05%7C01%7Cjeffm%40microsoft.com%7Cb2ba2663ee284f05902008da63c1c866%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637931981216284830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8svEl5BpDERhKQ3RJvw9ee6KD6Q5sszCBJJWQwcF6IU%3D&reserved=0
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D





More information about the cifs-protocol mailing list