opmsg message encryption
opmsg is a replacement for gpg which can encrypt/sign/verify your mails or create/verify detached signatures of local files. Even though the opmsg output looks similar, the concept is entirely different.
Features:
cat, shred -u and ls on the cmdlineopmsg builds fine with any of the OpenSSL, LibreSSL and BoringSSL libcrypto libraries. Building against BoringSSL is not recommended due to missing blowfish and ripemd algorithms.
You can use various transports with opmsg such as Mail or drops. Keys can be exchanged via mail, brainkeys or QR codes.
opmsg requires the crypto primitives from OpenSSL. Just relax, its
not using the SSL/TLS proto, just the ciphering and hash algorithms.
For standard Linux distros, just type make.
The compilation requires a C++ compiler that supports -std=c++11.
This can be configured with e.g. make CXX=eg++ on OpenBSD.
This project supports both BN_GENCB_new and BN_GENCB for big number
generation. To disable BN_GENCB_new, set HAVE_BN_GENCB_NEW to false:
make DEFS=-DHAVE_BN_GENCB_NEW=0. So on OpenBSD, you would run
make CXX=eg++ DEFS=-DHAVE_BN_GENCB_NEW=0. On OSX you should install
your own OpenSSL, as Apple marks OpenSSL as deprecated in favor of their own
crypto libs. You may also set all these options in the Makefile.
It successfully builds on Linux, OSX, OpenBSD and probably a lot of others (Solaris, FreeBSD,...).
…If you want to use additional features, such as from opmux (opmsg/gpg auto forward) or opcoin
(using bitcoin network as a web-of-trust), also type make contrib. Contrib tools are
documented in README2.md. You may also want to check
opmsg-qr later on, to im/export opmsg
personas via QR codes, once you have set up your working environment.
The key concept of opmsg is the use of personas. Personas are an identity with either an EC or RSA key bound to it. Communication happens between two personas (which could be the same) which are uniquely identified by the hashsum of their EC/RSA keys:
…This is pretty self-explaining. A new persona with name stealth is
created. The public RSA key of this persona has to be imported by
the remote peer that you want to opmsg-mail with via
opmsg --import --phash sha256 --name stealthjust as hinted above. After pasting the public key of your communication peer
into above commandline - once it told you to do so - you will be given the persona ID,
that consists of the hashsum (sha256 in this case) of the public key. ID's
may be presented to you in --short, --long, or --split (default) form,
and will be auto-detected in either form as you pass it to the command line.
opmsg does not rely on a web-of-trust which in fact never really worked. Rather, due to ubiquious messenging, its much simpler today to verify the hashsum of the persona via additional communication paths. E.g. if you send the pubkey via plain mail, use SMS and twitter to distribute the hash, or send a picture/selfie with the hash and something that uniquely identifies you. Using two additional communication paths, which are unrelated to the path that you sent the key along, you have a high degree of trust. Side-note: If you want to stay anonymous, do not send selfies with your persona id and dont use communication paths that can be mapped to you.
By default sha256 is used to hash the pubkey blob but you may also specify ripemd160
or sha512. Whichever you choose, its important that your peer knows
about it during import, because you will be referenced with this hex hash value
(your persona ID) in future.
The private part of the keys which are stored inside ~/.opmsg
are NOT encrypted. It is believed that once someone gained access
to your account, its all lost anyway (except for PFS as explained later),
so a passpharse just add a wrong feeling of security here. Keep
your account/box unpwned! Otherwise end2end encryption makes little
sense.
opmsg encourages users for easy persona creation and throwaway.
The directory structure below ~/.opmsg is easy and straight
forward. It just maps the hex ids of the personas and (EC)DH keys
to directories and can in fact be edited by hand.
Creation of RSA personas might take some time. Not just an RSA key is generated in that case - which is not very time consuming - but also DH parameters (2048bit by default) that are used to implement PFS in later messenging (see later chapter).
In order to speed up persona generation and to encourage use- and throwaway
and per-project personas, EC support was added to opmsg as of version=1.5.
Instead of --newp you would just use --newecp and everything else is the
same. opmsg will pick the right crypto transparently to you. No need to add
any further switches for encryption or alike. EC personas use the brainpool curves
(RFC 5639). The NIST curve secp521r1 may also be used as a fallback if your
libcrypto is outdated, but its recommended to use the brainpool curves which
dont keep any secrets about how their group parameters were selected.
Also see the chapter about cross-domain ECDH down below.
Although this step is not strictly necessary, it is recommended. As personas are easily
created, you can (should) create a dedicated persona for each of your "projects" or
contacts. That is, if you have 7 communication partners/peers, you should have
created 7 personas; one EC/RSA key for each of them. To handle that easily with your
mailer (see later for MUA integration), you should add a proper --name, describing your
id. If you are using email addresses along with names, use the format of --name 'da name '
so that your MUA can easily pick a list of candidates for you.
Additionally, you should --link your source persona (each of the 7 you created)
to the particular destination persona that you wish to communicate with using this source id:
$ opmsg --link b3c32d47dc8b58a6 --persona 1cb7992f96663853
opmsg: version=1.2 -- (C) 2015 opmsg-team: https://github.com/stealth/opmsg
opmsg: linking personas
opmsg: SUCCESS.
This is to avoid the need to specify --persona each time you
send a message to a different target persona, changing your local
id back and forth inside the config file or at the command line.
Above command says, that each time you send an opmsg to b3c32d47dc8b58a6,
the keying material from your local id 1cb7992f96663853 is used. To unlink
your id from b3c32d47dc8b58a6, remove the srclink file inside this personas
directory.
If no link is found for a persona, the config file and given
--persona argument is evaluated. Command line arguments override the config file settings.
Given proper mail provider support (e.g. inboxes are created on the fly for addresses like [email protected]), the global surveillance meta graph would just contain pairs of communication partners. No clusters, just islands of 1:1 mappings.
There may be valid scenarios where you dont want your communication peer to have a way to proof that you wrote a certain message. Since op messages are always signed with your persona key, peer could proof that you were expressing illegal thoughts. So you want deniable messages that are still integrity protected. The OTR protocol is handling this by sharing the public as well as the private key for a dedicated communication session between both peers.
opmsg allows to do the same. It requires an additional communication step with a peer that you already imported once and which you suspect to do such back stabbing. (Generally speaking its wise to assume that case.)
It is recommended to use EC personas for that purpose, as its faster. Just add --deniable
switch on the commandline when creating or importing this deniable persona as well
as a --name that reflects deniability for you.
This will print or import the private key half of the persona and link it to itself.
As this new persona is linked to itself, whenever you send something to the peer the
signing key is shared with that peer. You can always deny that you sent this message
as your peer could also have signed it (src-id and dst-id inside the message are the same).
Only exchange deniable persona keys across an existing secure (encrypted) channel as it
contains private keying material.
Do not share any key material of this dedicated new EC persona to anyone else. Its only for
this dedicated, deniable, communication peer.
Once a deniable peer is established, you may use it as often and as long as you wish and as within normal operation. Deniable op messages are integrity protected and feature all crypto benefits.
Of course for this to work you also want to have fully encrypted your disk to leave no
forensic artifacts and dont want to cite your peer in reply-messages as this proofs
that you were able to decrypt a mail from your peer, e.g. you are hold of a certain
private session key (kex-id). Thats a common mistake people make who dont sign
their emails and think everything is deniable.
Brainkey personas are deniable personas whose key was not generated via RNG input, but which are derived from a passphrase. They are very similar to the concept of BTC brainwallets. When generating brainkey personas, the commandline should be as explicit as possible in order to have matching personas on both sides despite potentially different config-file settings for EC curves or hash algos:
…Ofcorse, you should use a secret that nobody can guess or bruteforce, including
upper and lower-case, digits and so on. The idea behind brainkey personas is,
that you share a secret with your peer once you meet, and both sides can
then generate the same personas independently afterwards. There's no need to verify
finger prints or exchange keys. The salt parameter doesn't need to be secret and may
also be omitted. But it is a safety measure to chose a salt in order to make attacks
with rainbow tables unfeasable. If you are certain that no other users
are on your box, you may also pass the passphrase as --brainkey1=mysupersecretnobodyknows
on the commandline instead of typing it on stdin.
Brainkeys will only be used for deniable EC personas. The Kex (aka Session) keys
will nevertheless be generated randomly, just as for other personas.
Brainkey personas can then be used just as normal. Once created, you may just
forget the brainkey, as you will never need to generate it again.
As of version=4 messages, opmsg supports personas who resist quantum computing power.
These personas have type pq1 in the opmsg -l listing and are basically brainkey
personas as above but include a symmetric salt thats used together with the ECDH Kex
to derive the session key. The integrity of version=4 (and above) messages is not only
protected by asymmetr
No open issues yet, or sync has not completed.