Skip to content

JustNevi/cmemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CMEMO

This is an implementation of the OMEMO protocol based on X3DH written in C.

Get to know the main idea of the project: Main idea

Terms

  • Unit - user, friend, one side of the conversation.

Dependencies

  • libsodium

Features

Initialization

Flags: --init | -i.

cmemo -i

Export

Export yours public bundle to share them.

Flags: --export | -x.

cmemo -x > pub.bl 

Add unit

Flags: --add | -a.

cmemo -a < unit_pub.bl

Note unit

Value here is fingerprint of added unit public bundle.

Flags: --unit | -u.

cmemo -u 6860b33af65db960db48932aef5d512

Request for conversation

To start a conversation, you need to make a request.

You and your interlocutor must agree on a common starting key for the conversation and the ID of the one-time prekey. The key needs to be from 1 to 32 characters long (above 32 no sense) and the ID must be from 0 to 99.

For example, the key "NONCE_SUPER_KEY" and the ID "67". They must be written using the ":" symbol:

NONCE_SUPER_KEY:67

You must save the public ephemeral key when requesting.

Flags: --request | -q.

cmemo -q NONCE_SUPER_KEY:67 -u 6860b33 > /tmp/eph.key

Response for conversation

Flags: --response | -p.

cmemo -p NONCE_SUPER_KEY:67 -u 48dabed < /tmp/eph.key

Send message

Flags: --send | -s.

cmemo -s -u 48dabed < /tmp/msg > /tmp/enmsg

Receive message

Flags: --receive | -r.

cmemo -r -u 6860b33 < /tmp/enmsg > /tmp/demsg

Encoding

Used to indicate that you are receiving or sending encrypted data. Currently used "HEX".

Flags: --encode | -e.

echo "Hello, how are you?" | cmemo -s -u 48dabed -e
# Output: e831361abb5b73d...
echo "e831361abb5b73d..." | cmemo -r -u 6860b33 -e
# Output: Hello, how are you?

Usage

Example

Create directories for Alice and Bob.

mkdir -p /tmp/cmemo/alice
mkdir -p /tmp/cmemo/bob

In two shells, we set the HOME for Alias and Bob.

export HOME="/tmp/cmemo/alice"
export HOME="/tmp/cmemo/bob"

Initializing

Alice/Bob:

cmemo -i

Bundles exchange

Alice:

cmemo -a < /tmp/cmemo/bob/.cmemo/public.bl

Bob:

cmemo -a < /tmp/cmemo/alice/.cmemo/public.bl

Request/Response

Key: ExampleKey00
ID: 69

Alice:

cmemo -q ExampleKey00:69 -u 0bfb608d2 -e > /tmp/cmemo/ep.key

Bob:

cmemo -p ExampleKey00:69 -u e2e5a35dcd2 -e < /tmp/cmemo/ep.key

Send/Receive

Alice:

echo "Hello, Bob" | cmemo -s -u 0bfb608d2 > /tmp/cmemo/enmsg

Bob:

cmemo -r -u e2e5a35dcd2 < /tmp/cmemo/enmsg
# Output: Hello, Bob

Bob:

echo "Hi, Alice" | cmemo -s -u e2e5a35dcd2 -e
# Output: f5fcde767b83...

Alice:

echo "f5fcde767b83..." | cmemo -r -u 0bfb608d2 -e
# Output: Hi, Alice

Main idea

The main idea of the project is to enable sending end-to-end encrypted messages regardless of the method of transmission. You can easily use it in unencrypted messengers, game chats, radio, and so on. That is, you can write various extensions that can integrate into the chat, track history for any method of communication.

TODO

  • Add base64 encoding.
  • Clean code.
  • Binding a nickname to unit.
  • Export public bundle.
  • Size-independent initial key.
  • Add more errors messages.

Contribution

This is my first project on C. I would be happy for any support and I absolutely accept consideration of any suggestions and improvements.

About

OMEMO in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors