sigalor / whatsapp-web-reveng

Reverse engineering WhatsApp Web.
MIT License
6.16k stars 807 forks source link

get MediaKey #55

Open jhow2892 opened 6 years ago

jhow2892 commented 6 years ago

Hello!

I saw that we return from this amazing project when I get a file it returns me to mediaKey, I would like to know if this return is done by whatsapp server or has some way of generating it based on media_enc_hash and media_enc.

sigalor commented 6 years ago

I guess the mediaKey generation is part of the WhatsApp APK and its communication with WhatsApp Web. It has not yet been investigated how the underlying cryptography algorithms work together, i.e. not only mediaKey, but also secret, encKey and macKey.

wiomoc commented 6 years ago

An interesting part is that for the same file you'll get everytime the same media key

SchulteMK commented 6 years ago

The media encryption details are unique for every file and independent of the user. The idea is to be able to forward a file without reuploading it every time. The encryption details are part of the protobuf object. This object is protected by the standard end-2-end encryption, so that nobody is able to decrypt the file without these information. It sounds a bit confusing, but I hope I could help you