Pad the SHA-1 hash for Gen5 and below servers

This commit is contained in:
Cameron Gutman
2020-06-09 01:13:30 -07:00
parent a4f7861ccf
commit abb4b5f9b9

View File

@@ -152,7 +152,12 @@
else {
challengeRespHash = [cryptoMan SHA1HashData: challengeRespHashInput];
}
NSData* challengeRespEncrypted = [cryptoMan aesEncrypt:challengeRespHash withKey:aesKey];
assert([challengeRespHash length] <= 32);
NSMutableData* paddedHash = [NSMutableData dataWithData:challengeRespHash];
[paddedHash setLength:32];
NSData* challengeRespEncrypted = [cryptoMan aesEncrypt:paddedHash withKey:aesKey];
HttpResponse* secretResp = [[HttpResponse alloc] init];
[_httpManager executeRequestSynchronously:[HttpRequest requestForResponse:secretResp withUrlRequest:[_httpManager newChallengeRespRequest:challengeRespEncrypted]]];