-3
$\begingroup$

I have 2 set of public/private keys. I would like to know how I can calculate DHKey.

e.g:

P-192
Private A:   07915f86918ddc27005df1d6cf0c142b625ed2eff4a518ff
Private B:   1e636ca790b50f68f15d8dbe86244e309211d635de00e16d
Public A(x): 15207009984421a6586f9fc3fe7e4329d2809ea51125f8ed
Public A(y): b09d42b81bc5bd009f79e4b59dbbaa857fca856fb9f7ea25
DHKey:       fb3ba2012c7e62466e486e229290175b4afebc13fdccee46

These data have been extracted from the Bluetooth v4.2 Core Specification.

$\endgroup$
2
  • 1
    $\begingroup$ Are you looking for a theoretical explanation or implementations? $\endgroup$ – yyyyyyy Feb 25 '16 at 13:12
  • $\begingroup$ I am looking for an implementation. $\endgroup$ – J. Avod Feb 25 '16 at 13:20
2
$\begingroup$

Generally, the shared secret DHKey is the first coordinate of the $b$th multiple of the point $A$, denoted $[b]A$. Here, $b$ represents B's private key Private B and $A$ is A's public key Public A.

Using the computer algebra package sage, this can be computed as follows. First, we set up the NIST curve P-192 (the constants can be found online):

sage: p = 6277101735386680763835789423207666416083908700390324961279
sage: b = 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1
sage: E = EllipticCurve(Zmod(p), [0, 0, 0, -3, b])

Then, we plug in the given values and compute $Q:=[b]A$:

sage: b = 0x1e636ca790b50f68f15d8dbe86244e309211d635de00e16d
sage: Ax = 0x15207009984421a6586f9fc3fe7e4329d2809ea51125f8ed
sage: Ay = 0xb09d42b81bc5bd009f79e4b59dbbaa857fca856fb9f7ea25
sage: Q = b * E(Ax, Ay)

...yielding the desired value:

sage: hex(Integer(Q[0]))
'fb3ba2012c7e62466e486e229290175b4afebc13fdccee46'

If you want to perform this computation in a different environment (other programming languages, etc.), I am sure you will find plenty of implementations for point multiplication on P-192 using your favourite internet search engine.

$\endgroup$
1
  • $\begingroup$ Exactly what I needed. It would have been even better if you provided command line tools, but that's not the point. Thank you. $\endgroup$ – J. Avod Feb 25 '16 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.