Coder Social home page Coder Social logo

vanitasvitae / smack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from igniterealtime/smack

16.0 16.0 3.0 34.48 MB

A modular and portable open source XMPP client library written in Java for Android and Java (SE) VMs

Home Page: https://igniterealtime.org/projects/smack/

License: Apache License 2.0

Java 99.81% Shell 0.09% HTML 0.07% CSS 0.01% Makefile 0.01% Scala 0.02%
encryption java omemo xmpp

smack's People

Contributors

adiaholic avatar alexwen avatar annovanvliet avatar bgrozev avatar billjive avatar bjalon avatar cmeng-git avatar damencho avatar daniele-athome avatar dant3 avatar dev-0404 avatar fishbowler avatar flowdalic avatar gadgetworks avatar ge0rg avatar guusdk avatar ibauersachs avatar jadestorm avatar mf1-ms avatar mityada avatar miwix avatar noschinl avatar ramabit avatar serevaris avatar slushpupie avatar stawicki91 avatar tibo-lg avatar vanitasvitae avatar vito-c avatar wolfposd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smack's Issues

Allow proper signedPreKey rotation

Background: The client should generate and publish a new singedPreKey in their bundle every now and then (7-14 days). The old signedPreKey must be kept for ~a month in order to decrypt delayed preKeyMessages that were encrypted using the old signedPreKey. In order to strengthen forward secrecy, the old key should be deleted after a month though.

Possible solutions:

  • Rotate keys every n days and ensure that maximal floor(28/n) keys are kept in storage.
  • Store a creation date for every key and rotate/delete when keys are too old.

Manual rotation of the signedPreKey is already possible

Crashing when parsing messages from ChatSecure iOS

I updated to the latest smack-omemo libraries and they changed something related to parsing message keys and auth tags. If you don't send a 32 byte long message + auth key or something jt throws a runtime error and crashes. The old code that was replaced has a link to
ChatSecure/ChatSecure-iOS#647

All in all, it seems ChatSecure iOS is using the "legacy format" whatever that means. This is what @chrisballinger had to say:

"The legacy format shouldn't crash smack-omemo, that's a bug. Consuming both legacy and new format should be supported simultaneously. Likely enough people are using new format that we can move away from sending legacy, but it's not top priority."

API changes

@n8fr8 I just made some changes to the API. Beginning with 14013a7 one OmemoService can handle multiple OmemoManagers/Devices. That enables you to have multiple devices active on the same XMPPConnection (useful for eg. testing).

This results in a slightly different setup. First, the client has to take care of the deviceId, since the OmemoStore doesn't do that any longer (store it eg. in androids shared preferences). Second, OmemoManagers.getInstanceFor() now takes two arguments, first the Connection and second the id of either an existing device, or null if you want to create a new device.

In short, you should have the following composition now:

  • One OmemoService object per used OMEMO implementation (typically one SignalOmemoService).
  • One OmemoManager per device (now you can use multiple devices per account).
  • One OmemoStore per OmemoManager.
  • Each OmemoManager has a reference to the used OmemoService (in theory you could in the future have eg. 2 OmemoManagers, one using a SignalOmemoService, and one using a Olm/XYZOmemoService at the same time!)

I hope, I did not miss anything important. I also updated the documentation. If you have any questions, don't hesitate to ask :)
Since the API is likely undergoing some more changes until it is merged, I'll leave this one open for now to document the development :)

OmemoManager.getInstanceFor() returns different Object, when Manager was first created before connection login

Reported here.
This happens, when the OmemoManager was first created using OmemoManager.getIntanceFor(Connection) before the user logged in. In that case, there are two new jid folders in the OMEMO store: "[email protected]" and "user".

When the client than tries to get an instance of the OmemoManager via getInstanceFor after the user logged in, it gets an instance, that has no key material, so processBundle will throw an exception.

I suggest to either only create the OmemoManager after login, or keep one instance of the OmemoManager around as a local variable. Nevertheless, this must be fixed.

deviceID is not properly published

Not sure, if its an upstream bug in new PubSubManager.getOrCreateNode() by @Flowdalic or if it was introduced when adopting those changes.

Anyway it seams like the ID gets sent to the DeviceList Node, but DeviceList updates still do not contain it afterwards.

Also I have to rewrite deviceID publishing, since at the moment its not really perfect.

Cannot fetch bundles from ejabberd

When my account is on prosody and their account is on ejabberd 16.09, I cannot fetch their device bundle, because the iq result only arrives 1 sec after the timeout. This is true with timeout 10 secs as well as 50 or 60 secs. Strangely enough fetching device lists works (same procedure, only difference I spotted is missing "max_items=1" in the query. Fetching bundles from prosody <-> prosody works (tested on one server).

I'm not sure, if this is an upstream issue of smack, prosody or ejabberd or just a faulty configuration. Maybe @Flowdalic has heard of something like this/has an idea how to debug this?

Don't try to decrypt MAM messages on a new device

Could be done by eg. stopping to decrypt after 50 failures (like Conversations), or similar.
The library should do this, because when the device created fresh keys, it will not be able to decrypt all messages in MAM, since none will be encrypted for the freshly generated key.

Integration tests: deviceList is not cleared properly

deviceList node contains deviceIds of older tests despite the fact all items are deleted as well as the node itself.

Maybe this is caused by delayed PEP updates (race condition)?

Its not fatal, but its ugly to have all those exceptions in the log.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.