Skip to content

Conversation

@vanitasvitae
Copy link
Member

@vanitasvitae vanitasvitae commented May 3, 2019

This PR adds support for OMEMO Media Sharing to Smacks HttpFileUploadManager.

The manager can now upload files encrypted to the server. As a result the user gets a aesgcm url-string which can be shared with others. There is also a function that retrieves a Cipher from an aesgcm string, which can then be used to decrypt the file/stream.

Since OMEMO Media Sharing is basically independent of OMEMO, I chose the HttpFileUploadManager as the best place to implement this feature.

There are also some changes to other packages. StringUtils now contains a method to decode hexadecimal Strings into byte arrays and the OMEMO code can generate IVs more flexible in order to prepare for the switch from 16 byte IVs to 12 byte IVs.

Missing:

  • decide, whether or not Smack should provide a function to convert a aesgcm string into a URL
  • figure out, whether a aesgcm:// url should be translated to http or https

    Note: HTTP Upload has transport encryption as a MUST. Non HTTPS URLs MUST not be converted to the aesgcm URL scheme.

  • maybe create custom data type for aesgcm urls?
  • code clean up
  • decide, if a method to download + decrypt files would be necessary

    naah

  • get feedback
  • squash

@vanitasvitae vanitasvitae force-pushed the omemo_media_sharing branch from 8e139d5 to 91cac14 Compare May 3, 2019 14:20
@vanitasvitae vanitasvitae changed the title WIP: OMEMO Media Sharing via HTTP File Upload OMEMO Media Sharing via HTTP File Upload May 3, 2019
@Flowdalic
Copy link
Member

Regarding the API design you probably should keep https://issues.igniterealtime.org/browse/SMACK-867 in mind.

@vanitasvitae
Copy link
Member Author

I'm not quite happy with this as of now. I'm not entirely sure, if I used the AlgorithmParameterSpecs correctly. Currently the decrypted file is 32 bytes longer than the original. This is probably the authentication tag and/or IV. However, since the tag length of AESGCM is configurable, I'm not sure, how one can calculate that length reliably when receiving a file.

@cmeng-git
Copy link
Contributor

aTalk v1.8.3 has implemented OMEMO Media Sharing using your source. Thanks for the contribution.

@vanitasvitae vanitasvitae force-pushed the omemo_media_sharing branch from be5f811 to ce2b79c Compare June 30, 2019 16:26
@vanitasvitae vanitasvitae force-pushed the omemo_media_sharing branch from ce2b79c to 9a635e7 Compare June 30, 2019 16:47
@vanitasvitae
Copy link
Member Author

The integration test does now no longer fail.

@Neustradamus
Copy link

@vanitasvitae: Have you progressed on it?

@stokito
Copy link
Contributor

stokito commented Oct 6, 2025

@cmeng-git could you please create a PR with the updated and working version?
After your message the vanitasvitae added new commits that may be missing in your version.
It looks like you added the OMEMO file sharing in PR # 520 and it would be great to simplify that PR and review the feature in a separate PR.
You can add Replaces: #317 to the PR description

cmeng-git added a commit to cmeng-git/Smack that referenced this pull request Oct 7, 2025
@cmeng-git
Copy link
Contributor

I have raised the PR as requested i.e.
PR for XEP-0454 Media File Sharing #680

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants