[OTR-dev] A C# lib

Ian Goldberg ian at cypherpunks.ca
Sat Jan 15 09:10:28 EST 2005

On Sat, Jan 15, 2005 at 12:55:18AM -0500, alex323 wrote:
> As you might have heard, I'm making a libary in C# for OTR.

Wow.  That's awesome.  [Not to mention that it's super-useful to have
interoperable implementations of a protocol.]

> I have a few questions however regarding the protocol:
> * What is the size of the DH key I need to generate? (I don't think it's 
> 1536.. I tried it)
> * I have two editable parameters with my DH class: P and G. Should G be 
> set to 0x02 and P should be set to the key you generated?

  - DH y (MPI)
    - The initial DH public encryption key.  The DH group is the one
      defined in RFC 3526 with 1536-bit modulus (hex, big-endian):
            FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
            29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD
            EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245
            E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED
            EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE45B3D
            C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8 FD24CF5F
            83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D
            670C354E 4ABC9804 F1746C08 CA237327 FFFFFFFF FFFFFFFF
      and generator 2.

So yes, it's 1536 bits.  G = 0x02, and P is the above 1536-bit modulus.
(We didn't generate it; it's the standard one from RFC 3526.)

> What about the DSA key length?

1024 bits (the largest the standard allows).

> * Why doesn't the protocol say that you need to include a NULL (byte 0) 
> as the first character of the key exchange message?

Well, the first field of the Key Exchange Message (after base64-decoding) is:

  - Protocol version (SHORT)
    - The version number of this protocol is 0x0001.

So that'd be encoded as \x00\x01.  Is that the NUL you're talking about?

> * Why is there an 'e' in the DSA key? My only options are P, Q, G, Y, 
> and X. Wikipedia told me that X was the private key.

'e' == 'Y'.  There was this problem that 'Y' was already used by the DH
key in the Key Exchange Message.  X is indeed the private key [which of
course never gets sent in the protocol ;-) ]

> Thanks in advance for your answer(s).

No problem.

   - Ian

More information about the OTR-dev mailing list