# How to calculate kinv from the given k value

I am implementing an ECDSA NIST test vectors verification application. The test vectors are taken from http://csrc.nist.gov/groups/STM/cavp/#09.

One of the test vectors is given below:

P-192 SHA1

Msg = 608079423f12421de616b7493ebe551cf4d65b92
d = e14f37b3d1374ff8b03f41b9b3fdd2f0ebccf275d660d7f3
Qx = 07008ea40b08dbe76432096e80a2494c94982d2d5bcf98e6
Qy = 76fab681d00b414ea636ba215de26d98c41bd7f2e4d65477
k = cb0abc7043a10783684556fb12c4154d57bc31a289685f25
R = 6994d962bdd0d793ffddf855ec5bf2f91a9698b46258a63e
S = 02ba6465a234903744ab02bc8521405b73cf5fc00e1a9f41


I am trying to calculate $k_{inv}$ from given $k$ value and I am using curve “NID_X9_62_prime192v1”.

Can anyone tell me how to calculate $k_{inv}$?

• Closely related to this question – fgrieu Sep 16 '14 at 6:41

Just compute the multiplicative inverse $k^{-1}$ of $k$ modulo the prime order $n$ of the base point $G$ (I used the typical notation for the domain parameters of the curve). This can efficiently be done using extended Euclid and should be available in any reasonable big integer library (typically something like modinverse). Thats it.