A cross-platform open source implementation and desktop client for the Threema Messenger App.
openMittsu is governed by the GNU GPL v2.0 license, but includes works from different people, licensed under different terms. See LICENSE
for more information.
Currently, the application has been built and tested on:
- Windows 7 using Visual Studio 2019
- Windows 10 using Visual Studio 2019
- Debian 9 using GCC 6.3 (AMD64)
- Debian 9 using GCC 6.3 (i386)
- Debian 9 using GCC 6.3 (PPC)
Other platforms should work with no or minimal changes.
Currently we only provide binaries for the following platforms:
-
Windows 32bit (x86) and 64bit (x64) – Scroll down to find the latest build. Do not forget to install the Visual Studio Redistributable (
vcredist_x64.exe
). -
Linux-bases systems using an AppImage: Download from BinTray. Do not forget to update the AppImage every now and then!
-
Debian 9 (on amd64, i386 and armhf) using our APT repository:
- First, add the GPG key for the repository:
wget -O - https://packages.openmittsu.de/openmittsu.packages.gpg.key | sudo apt-key add -
- Now, add the repository. As root or using sudo, create a file called "openmittsu.list" in
/etc/apt/sources.list.d/
with the following contents:deb https://packages.openmittsu.de/apt/debian stretch main
- You can now install (or update) openMittsu using:
sudo apt-get update
sudo apt-get install openmittsu
- First, add the GPG key for the repository:
The application stores your ID, contacts and messages in a database. A new database can be created using the "Load Backup" Wizard available from Database > Load Backup. You can either import an ID backup (containing only your ID and private key, no contacts or messages), or import a full data backup.
- ID Backup:
- Export the identity from the Threema App. To do this, in the Threema App-menu, select "My Backups" and then create an ID Backup.
After entering a password, a string of the form "AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA" is displayed. - In openMittsu, click on Database, Load Backup, ID Backup.
- Enter the generated backup string and the password.
- Enter a secure password for the database. If SqlCipher support is available, the database is encrypted using this password.
- Choose a suitable location (an empty folder) and let the application save the generated database there.
- Export the identity from the Threema App. To do this, in the Threema App-menu, select "My Backups" and then create an ID Backup.
- Data Backup:
- Export the data from the Threema App. To do this, in the Threema App-menu, select "My Backups" and then create a Data Backup.
After entering a password and waiting for the backup to complete, transfer the backup to your computer.
Now, extract the backup (a .zip file) to a secure folder (in your home directory for example) using the chosen backup password. 7zip or WinRAR can do this on Windows. - In openMittsu, click on Database, Load Backup, Data Backup.
- Point openMittsu to where you extracted the backup and enter the chosen backup password.
- Enter a secure password for the database. If SqlCipher support is available, the database is encrypted using this password.
- Choose a suitable location (an empty folder) and let the application save the generated database there.
- Export the data from the Threema App. To do this, in the Threema App-menu, select "My Backups" and then create a Data Backup.
Load the created database from the central GUI and point the file dialog to the directory where you chose to store the database.
After entering the password, the file should be displayed as loaded and active and contacts etc. should appear, if there are any.
Click Connect to connect to the Threema servers and chat!
Find detailed steps for Linux and Windows systems below.
-
Clone this repository or extract the sources from the archive.
If you clone the repository, do not forget to intialize the submodules (i.e. external git repositories):git submodule init git submodule sync git submodule update --init --recursive
-
Install or build both
libsodium
(for exampleapt-get install libsodium-dev
) andlibqrencode
(for exampleapt-get install libqrencode-dev
).
Note that openMittsu requires at leastlibsodium
1.0.12 or newer. -
Run CMake on the main directory. Point CMake to the installation locations of
libsodium
andlibqrencode
, if required, usingLIBSODIUM_INCLUDE_DIRS
,LIBSODIUM_LIBRARIES
,LIBQRENCODE_INCLUDE_DIR
andLIBQRENCODE_LIBRARY
, respectively. -
Once Makefiles or a solution (MSVS) has been successfully generated, start the build process.
On Windows, choosing aDEBUG
configuration causes the application to show an additional terminal window containinig run-time debug information and logs.Adding support for encrypted databases using
sqlcipher
: This is where it gets messy. You need the Qt5 private development headers (apt-get install qtbase5-dev qtbase5-private-dev
) and libsqlcipher (apt-get install libsqlcipher0 libsqlcipher-dev
).You need to make sure that you are using the latest version of
libsqlcipher
(at this time 3.4.1) – if not, you will getSEGMENTATION FAULTS
. Older versions still links against OpenSSL 1.0.x, which is incompatible with the version of OpenSSL linked by Qt. The issue has been fixed in Debian 9 since version3.2.0-2+deb9u1
.A (patched) version of
libsqlcipher
which also builds under Windows (build usingnmake -f Makefile.msc
, adapt paths in Makefile.msc to Windows SDK on variable TCC and RCC, adapt paths to OpenSSL binaries (use these non-light installers) at all locations referencing OpenSSL) is available here.Now you need to build the wrapper between SqlCipher and Qt.
Clone the repository (
git clone https://github.com/blizzard4591/qt5-sqlcipher.git
), configure with cmake (createbuild/
directory in the cloned folder, executecmake ..
).If you are using Windows, you first need to change two entries in CMakeLists.txt:
There are two lines marked with# Change this by hand if needed
, right below the variablesSQLCIPHER_INCLUDE_DIRS
andSQLCIPHER_LIBRARIES
are defined.
Update the paths to point to your checkout of sqlcipher (INCLUDE_DIRS) and to your sqlite3.lib file created by nmake:set(SQLCIPHER_INCLUDE_DIRS "C:/somePath/sqlcipher") set(SQLCIPHER_LIBRARIES "C:/somePath/sqlcipher/sqlite3.lib")
Now build
QSqlCipher
. If everything went well there should be a library insqldrivers/
.You can run
qsqlcipher-test
to see if your version of SqlCipher produces Segfaults or not – if you do not get past Test 5.2, update your installed version oflibsqlcipher
.The library created here (and
sqlite3.dll
in the case of Windows) need to be in openMittsu's main directory (the QSqlCipher module MUST be in a subfolder namedsqldrivers
!).On Linux, you also have the option of installing QSqlCipher as a global Qt5 plugin. On Debian 9 x64, the system-wide storage for plugins is in
/usr/lib/x86_64-linux-gnu/qt5/plugins
. For copying the plugin there you need root privileges. The command would look likesudo cp ./sqldrivers/libqsqlcipher.so /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/
.
Prerequisites on Debian/Ubuntu:
apt-get install libqt5core5a libqt5gui5 libqt5multimedia5 libqt5multimedia5-plugins libqt5sql5 libqt5sql5-sqlite libqt5widgets5 qt5-qmake qtbase5-dev qtbase5-dev-tools qtmultimedia5-dev libqrencode-dev git g++ libssl-dev make cmake qtbase5-dev qtbase5-private-dev pkgconf gstreamer1.0-libav libavcodec-extra
Important: If you are using Debian 9: To install a more recent version of libsodium
(at least 1.0.12) and a fixed version of SqlCipher, you need to have the openMittsu repository in your APT configuration.
To do this safely, add deb https://packages.openmittsu.de/apt/debian stretch main
as described in the section on binaries.
After running apt-get update
, you can install the additional packages using:
apt-get install libsodium-dev libsodium23 libsqlcipher0 libsqlcipher-dev
Prerequisites on openSuse (incomplete):
sudo zypper install libqt5-qtbase-devel libqt5-qtmultimedia-devel libsodium-devel qrencode-devel git g++ cmake
Adjust the paths to your system. The ones below are a current Qt version installed on OSX via brew. Look above for hints on how to add SqlCipher (encrypted database storage) support!
cd my-projects/ # or wherever you want to clone this
# If you are on Mac OSX (install Qt5 using Homebrew, and then find the suitable paths for your installation)
export Qt5Core_DIR=/usr/local/Cellar/qt5/5.7.0/lib/cmake/Qt5Core/
export Qt5Gui_DIR=/usr/local/Cellar/qt5/5.7.0/lib/cmake/Qt5Gui/
export Qt5Widgets_DIR=/usr/local/Cellar/qt5/5.7.0/lib/cmake/Qt5Widgets/
export Qt5Network_DIR=/usr/local/Cellar/qt5/5.7.0/lib/cmake/Qt5Network/
export Qt5Multimedia_DIR=/usr/local/Cellar/qt5/5.7.0/lib/cmake/Qt5Multimedia
# First build QSqlCipher
git clone https://github.com/blizzard4591/qt5-sqlcipher.git
cd qt5-sqlcipher
mkdir build
cd build
# If you are on Windows, the next step required some more parameters to cmake, aka the paths to SqlCipher include and library.
cmake .. # or cmake .. -G Xcode
make
# Either later on copy the created library in sqldrivers/ by hand to openMittsu, or install into system wide Qt5 plugin folders (look for the location of libqsqlite.so)
# Build openMittsu
git clone https://github.com/blizzard4591/openMittsu.git
cd openMittsu
mkdir build
cd build
cmake .. # or cmake .. -G Xcode, optionally add -DOPENMITTSU_DEBUG=On
make # optionally add -j 4 for multi-threaded compilation with 4 threads
./openMittsu
-
Install CMake
-
Download the latest version of
libsodium
Either pick the sources and compile them yourself, or use the provided binaries for MSVC in the -msvc.zip packages. Assuming you use the precompiled version and extracted them toC:\cpp\libsodium-1.0.xx-msvc
, where xx is the most recent version, the values for CMake later on will be:
LIBSODIUM_LIBRARIES = optimized;C:\cpp\libsodium-1.0.xx-msvc\x64\Release\v142\static\libsodium.lib;debug;C:\cpp\libsodium-1.0.xx-msvc\x64\Debug\v142\static\libsodium.lib
andLIBSODIUM_INCLUDE_DIRS = C:\cpp\libsodium-1.0.xx-msvc\include
. -
Clone and build the
qrencode library
Use the solution provided invc15/
and build only the targetqrcodelib
in modesDebug-Lib
andRelease-Lib
. The basepath whereqrencode.h
is located will serve as the include directoryLIBQRENCODE_INCLUDE_DIR
and we defineLIBQRENCODE_LIBRARY = optimized;C:\cpp\qrencode-win32\qrencode-win32\vc15\x64\Release-Lib\qrcodelib.lib;debug;C:\cpp\qrencode-win32\qrencode-win32\vc15\x64\Debug-Lib\qrcodelib.lib
(change pathes according to your layout!). -
Download and install the latest Qt version. Check that you select the right version for your version of Visual Studio, for example msvc-2017-x64 for Visual Studio 2017 and 64bit builds.
-
Open the
CMakeLists.txt
file in the root folder of openMittsu and look forOPENMITTSU_CMAKE_SEARCH_PATH
.
Edit the path to point to your Qt installation. -
Start CMake and point it to the openMittsu directory. Lets say you cloned openMittsu to
C:\cpp\openMittsu
, then fill out the two lines in CMake as follows:Where is the source code: C:/cpp/openMittsu Where to build the binaries: C:/cpp/openMittsu/build
Using the
/build
folder allows us to perform an out-of-source build that does not pollute the sources with build files.
You can even have simultaneous x86 and x64 builds from the same source, just by using different build directories.
ClickConfigure
and select the appropriate generator for Visual Studio, for exampleVisual Studio 15 2017 Win64
for Visual Studio 2017 in 64bit mode.
After the first configuration run, there will be errors.
Insert the valuesLIBSODIUM_LIBRARIES
,LIBSODIUM_INCLUDE_DIRS
,LIBQRENCODE_LIBRARY
andLIBQRENCODE_INCLUDE_DIR
like discussed above.
ClickConfigure
again, and no more errors should appear – otherwise fill an issue.
ClickGenerate
and open the generated solution file in the build directory.
You can now build either a Debug or a Release build of openMittsu by using the standard Visual Studio target selection. -
Look above for hints on how to add SqlCipher (encrypted database storage) support!
openMittsu is a cross-platform open source implementation and desktop client for the Threema Messenger App. It has been created by reverse engineering the Threema mobile App and studying the publication from Jan Ahrens as well as the Threema Gateway.
The protocol Threema uses doesn't provide multi-device functionality (yet) which means you can't be connected with more than one device using the same ID simultaneously. However, if you disconnect your phone before connecting with openMittsu, you can use the same Threema ID for your phone and openMittsu. Please beware that you will only receive messages on one device. Alternatively, consult the Threema FAQ-answer on this topic: Can I install Threema on multiple devices?
No, please use the Threema app you purchased for generating an ID. You can use Threema on a second user on your phone or in an emulator if you need to as long as you have a legally purchased Threema app.
Yes, Threema tolerates the openMittsu project. However, if openMittsu will get abused, Threema may change their decision. Don't worry, your ID won't get banned just for using openMittsu (if you are using openMittsu just for instant messaging like you do with the Threema app).
No. The Threema GmbH is currently not interested in working on openMittsu.
No, if you want to send or receive Threema messages automatically, please use the official Threema Gateway API.
What's the difference between openMittsu and Threema Web?
While Threema Web relies on a working connection to your Android smartphone running Threema, openMittsu acts as a standalone client. You can use openMittsu without a phone. Also, openMittsu is a native application, not a JavaScript / browser based web application.
Without the initial research and publication by Jan Ahrens this project would have been so much more difficult, if not impossible.