Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

OMEMO Identity Key Signing does not match the Spec #172

Open
Tracked by #5
COM8 opened this issue Mar 30, 2022 · 0 comments · May be fixed by #173
Open
Tracked by #5

OMEMO Identity Key Signing does not match the Spec #172

COM8 opened this issue Mar 30, 2022 · 0 comments · May be fixed by #173

Comments

@COM8
Copy link
Member

COM8 commented Mar 30, 2022

Description

XEP-0384: OMEMO Encryption requires a EdDSA-compatible signature when signing Identity Keys. UWPX currently performs EdDSA with Curve25519 (Montgomery) based keys and not like mandated here by XEdDSA with Ed25519 (Twisted Edwards) keys.

Expected Behavior

We should use Ed25519 (Twisted Edwards) keys here.

Actual Behavior

/// <summary>
/// Generates the signature of the given <paramref name="preKey"/> and returns it.
/// </summary>
/// <param name="preKey">The <see cref="PreKeyModel"/> that should be signed.</param>
/// <param name="identiyKey">The private Key used for signing the given <paramref name="preKey"/>.</param>
/// <returns>The signature of the given <paramref name="preKey"/>.</returns>
public static byte[] SignPreKey(PreKeyModel preKey, ECPrivKeyModel identiyKey)
{
byte[] pubKey = preKey.pubKey.ToByteArrayWithPrefix();
Key key = Key.Import(SignatureAlgorithm.Ed25519, identiyKey.key, KeyBlobFormat.RawPrivateKey);
return SignatureAlgorithm.Ed25519.Sign(key, pubKey);
}

Possible Fix

Convert the Curve25519 (Montgomery) based keys to Ed25519 (Twisted Edwards) before signing. This is defined in by the XEdDSA spec inside the calculate_key_pair call.

Steps to Reproduce

  1. Add an account
  2. Connect the account
  3. UWPX will publish an OMEMO bundle with an "invalid" signature.
  4. Other clients (!= UWPX):💥

Context

We can no send OMEMO encrypted messages to other XMPP clients like Kaidan, that follow the spec.

@COM8 COM8 added the 🐛 Bug label Mar 30, 2022
@COM8 COM8 added this to the Release (v.1.0) milestone Mar 30, 2022
@COM8 COM8 linked a pull request Mar 30, 2022 that will close this issue
COM8 added a commit that referenced this issue Mar 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant