This repository was archived by the owner on Jan 29, 2024. It is now read-only.
  
  
  - 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 17
 
    This repository was archived by the owner on Jan 29, 2024. It is now read-only.
  
  
OMEMO Identity Key Signing does not match the Spec #172
Copy link
Copy link
Open
Labels
Milestone
Description
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
UWPX-Client/Omemo/Classes/KeyHelper.cs
Lines 89 to 100 in 2178990
| /// <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
- Add an account
 - Connect the account
 - UWPX will publish an OMEMO bundle with an "invalid" signature.
 - Other clients (!= UWPX):💥
 
Context
We can no send OMEMO encrypted messages to other XMPP clients like Kaidan, that follow the spec.