jlguardi / yowsup

The python WhatsApp library
http://www.openwhatsapp.org
GNU General Public License v3.0
42 stars 23 forks source link

[TODO] Encrypted media send doesn't work #39

Open ghost opened 8 years ago

ghost commented 8 years ago

When trying to forward encrypted image using echoClient, we get the following error: Message com.whatsapp.proto.Message is missing required fields: image_message.media_key

Full log:

DEBUG:yowsup.layers.logger.layer:rx:

3 ! ��M�7��j�8x 9�t�҂����x�YTA"��5M=��!BH1�b��|�^� =ב�;�Wv �/���U}H�=�©Ѵ��}��v׍ x�@��x���l{x����PD�]xbF���n�W ���q�ܗ�YFS���!���r��'�lڍ��8>�Pq{�쓣���X� �-s���uNE�/(2���T�O��F}�»�X����0@x�}�:��1�rÒe��X���z�PT�g��+_�0�/�������>�Pf<���}b�H�Cez� �f���M�n�M�E��(���Ë%1+=��@@ZE��׮TT���WX�ZΏ�U��{�o���GB9U%�t ����q�T�1lS,�����#�~�}|��h�Hv���ܕ�g��ϑ��'���A��h[�c�P�K�t܆m�� 2k)o��Y8X�Ym�Z��L�9��<��E��`����"qD�A�e�E��Dˌ�w6bz4�9�Y�$j����v[��,�̜ͣo�4B���0�?�ϓJ�_BL�t�~���C�\���T�h ����v�{1>�� IKD_�E��@���ΔP����oS��؊?�ki{V�Gf=]����b�K��9�8��C����Yʷ��e�>_�, J=�ٙb��IwgIj�Z��0^����v 6t�'�_���[�yĆ-g����O�E��]���c�:�O�Q��E��NJ���L��D^�^dώ���{?yp`U�����~O=�[W�Q����|�}�$�0��R��x*؞�_ҕ>�/a��>�7ѩe ��#�sIMBԑ�ח�O��>R����P�bL��m�œQ x �d2� T��\�#�ʮ*�G�����5��}b�C�������J�1�m�ګ�����8�*?UK;A{��������"K��a�ȕK)��NA�_lWۼ���|��t��*�8U�(Tgi��O�������q C���tp���� ��m��8( ���&��G��f��r�9�4Рb#��� ��QS���3��7?:�Rv�7�.U�+�_����`U_�ꁷ<%�?~��HdJQ�Y�[��4#:��<��c��J�i+� [� zR����E���S]Ҙ҆-�IX�k�Gͫ/#���x�K΅҄�k�+�;��/e��d�ޭ`���d_�g ���bZ,�����$��5x�X9�f,h���Q�=���=İB-�n ���:/�;�Yñ%����8��Y�KkR������CBې_� �Y;�B� ��X� /����LRU'"�&U�@P��j"�azV����/kc��� �n������?���E� F �_2ti�~j�HV��wMB\?YQ�T��&t� ;h����+�J�"��W�0������TƝ�L�6�=����;�<���%C���b2V'R�DX��F���FN�U�q���_�_����Z?��ey���!������c)E��� ��pr����y�Ok(f�9� �C&^�j-���ՋZ t�aF�_p���Iݻ�#�v3��I�6���3�!��1�0����A�)T �B c������n&p��|�ޢ%�!�AY�T���+��3)�B��C� Y+�ij��i����"Cq��;� ���nT��gQD#_�/�����_K,�`\�+II����pr�V�D�`���ocɌUj�x9�1�GBD�\oT�#(q�O�{�S;fuQ<Ͷ�Q;il����ߩ�`�X2�YK��&#�Y����X���¸��7��^���&] b���a�{�v���I���a&����r��|9�R9����s�9�y�[,+2�&�&� '��<���Ihs�S�������Y� ���a��f���sQ�h鐣���ku��N��������l��m��{�╦_jԦ%�F�27��=CV��k�1tP4<`=M*q B^P����(�آ$�����>{8��ˤ�T��#�X��Ֆ�Lk�!�e���&�4�k��0偋�u��f�~�/�w1��}ၮb�5V�(Ƨ� (�62�)�gV�����ٺe� Uy�Ptn�@��Î��d�%7K���f��/�����5<�SFZ=�����I��}@�#��y~�.�5D+��v�V�̷�C�T�t(� ݙ�W��]^�����N��{gGY��߫�pwށ�vǘr���0ȵ�An�JN���� 9�_��`=��D�`b� ���u���]�fzxxᇌ�' pzT `�K�e���ϯO�����s �F}Jw!�/�n}V��e�;(��/���l�+�������6��ݕ�_�p��l~�IV�8�6e����A�!sh�9�R���_���w$[���"�܄ngl�;��X>�G��m?\�22d�J��1�j�v��Ә 5[�[�H����]�€�����:�$~8��e�mAV����O�F+��ɻ�4���Ӹq���'����ؙ=�t&�

Echoing image https://mmi723.whatsapp.net/d/xMfjotZQ1w0QQzeepVOCbFb_6iM/AnOSQ48R3t2NpFSAs-JzHoi82dF98gogwdgQX01R86dp.enc to 97XXXXXXXX65 WARNING:yowsup.layers.axolotl.layer:Message com.whatsapp.proto.Message is missing required fields: image_message.media_key DEBUG:yowsup.layers.logger.layer:tx:

��� HEX:1f9e96e0

DEBUG:yowsup.layers.logger.layer:rx:

and retries...

msshapira commented 8 years ago

Same here. I tried to set the mediaKey to be the same as the original message mediaKey, but I guess that's not enough. Maybe the only way round is to download it and then re-upload it...

jlguardi commented 8 years ago

I'm not able to send encrypted media yet and so forward function doesn't works for encrypted media.

Reupload in plain mode could be a solution but I'm trying to enable media encryption. I've some improvements in the master but still WIP.

I gratefully accept comments and PR.

uraid commented 8 years ago

Maybe the reason forwarding an encrypted media doesn't work is that it's encrypted using the senders public key. So by forwarding the encrypted media we send an invalid message that can't be decrypted by the recipient. This can be verified by having 2 different yowsup clients- one forwards an encrypted media to the other. If the other yowsup gets the contents of the original encrypted media it'll try to decrypt it and maybe will log the error. If this is really the case then 'messageProtocolEntity.forward' need to have a check if there is an encrypted media and decrypt-re encrypt it, then forward it.

jlguardi commented 8 years ago

@yairh it isn't true. Encrypted media file is encrypted with a shared key sent in the message. And the message is encrypted with correct keys. However, protofuf arrives corrupted. I'm WIP.

mniak commented 7 years ago

@jlguardi this shared key is the media_key field?

jlguardi commented 7 years ago

@mniak yes, it is.

mniak commented 7 years ago

I've kinda fixed it in tgalal/yowsup pull request 2027. In reality I still can't send messages, but the EchoLayer is now working to me.

I've added some missing media_layer parsing capabilities on the layer_receive and some serialization logic for this field also.