Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
Olm
Commits
447501bd
Commit
447501bd
authored
9 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Document the pre-key messages
parent
9e79571d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/olm.rst
+42
-6
42 additions, 6 deletions
docs/olm.rst
with
42 additions
and
6 deletions
docs/olm.rst
+
42
−
6
View file @
447501bd
...
...
@@ -33,8 +33,8 @@ Curve25519 inputs: the previous ratchet key, :math:`T_{i-1}`, and the current
ratchet key :math:`T_i`. The even ratchet keys are generated by Alice.
The odd ratchet keys are generated by Bob. A shared secret is generated
using Diffie-Hellman on the ratchet keys. The next root key, :math:`R_i`, and
chain key, :math:`C_{i,0}`, are derived from the shared secret using an
HMAC-based Key Derivation Function (HKDF)
using :math:`R_{i-1}` as the salt.
chain key, :math:`C_{i,0}`, are derived from the shared secret using an
HKDF
using :math:`R_{i-1}` as the salt.
.. math::
\begin{align}
...
...
@@ -151,7 +151,6 @@ process so that they can decode out of order messages. If the receiver created
a new receiver chain then they discard their current sender chain so that
they will create a new chain when they next send a message.
The Olm Message Format
----------------------
...
...
@@ -161,13 +160,14 @@ Normal Messages
Olm messages start with a one byte version followed by a variable length
payload followed by a fixed length message authentication code.
.. code::
+--------------+------------------------------------+-----------+
| Version Byte | Payload Bytes | MAC Bytes |
+--------------+------------------------------------+-----------+
The version byte is ``"\x01"``.
The payload consists of key-value pairs where the keys are integers and the
values are integers and strings. The keys are encoded as a variable length
integer tag where the 3 lowest bits indicates the type of the value:
...
...
@@ -184,10 +184,46 @@ significant bits are stored in the first byte.
=========== ===== ======== ================================================
Name Tag Type Meaning
=========== ===== ======== ================================================
Chain-Index 0x0A Integer The chain index
, :math:`
j
`, of the message
Ratchet-Key 0x10 String The ratchet key
, :math:`
T_{i}
`, of the message
Ratchet-Key 0x0A String The ratchet key
, :math:`
T_{i}
`, of the message
Chain-Index 0x10 Integer The chain index
, :math:`
j
`, of the message
Cipher-Text 0x22 String The cipher-text, :math:`X_{i,j}`, of the message
=========== ===== ======== ================================================
The length of the MAC is determined by the authenticated encryption algorithm
being used. The MAC protects all of the bytes preceeding the MAC.
Pre-Key Messages
~~~~~~~~~~~~~~~~
Olm pre-key messages start with a one byte version followed by a variable
length payload.
.. code::
+--------------+------------------------------------+
| Version Byte | Payload Bytes |
+--------------+------------------------------------+
The version byte is ``"\x01"``.
The payload uses the same key-value format as for normal messages.
============ ===== ======== ================================================
Name Tag Type Meaning
============ ===== ======== ================================================
One-Time-Key 0x0A String Bob's single-use key, :math:`E_b`.
Base-Key 0x12 String Alice's single-use key, :math:`E_a`.
Identity-Key 0x1A String Alice's identity key, :math:`I_a`.
Message 0x22 String An embedded Olm message with its own version and
MAC.
============ ===== ======== ================================================
Olm Authenticated Encryption
----------------------------
Version 1
~~~~~~~~~
Version 1 of Olm uses AES-256 in CBC mode for encryption and HMAC-SHA-256 for
authentication. The 256 bit AES key, 256 bit HMAC key, and 128 bit AES IV are
derived from the message key using HKDF.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment