nRF9160-DK ECDSA v value

Hello!
We are trying to sign our data using ECDSA (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/crypto/ecdsa/README.html), so we can send our information to an Ethereum Blockchain. To send the transaction we need to obtain the "v value". Some searches made us understand that the "v value" is related to the coordinates of our "r value" so it should be 0 or 1 plus 27. Is there a way to obtain the coordinates of our "r value"? Or better, is there a way to obtain the " v value"?

Thank you very much!

Parents Reply Children
  • 4.1.4 Verifying Operation
    Entity V must verify signed messages from entity U using ECDSA using the keys and parameters
    established during the setup procedure and the key deployment procedure as follows:
    Input: The verifying operation takes as input:
    1. An octet string M which is the message.
    2. Entity U’s purported signature S = (r, s) on M.
    3. Optional: extra information to recover R efficiently from r (see below).
    Output: An indication of whether the purported signature on M is valid or not — either “valid”
    or “invalid”.
    Actions: Verify the purported signature S on M as follows:
    1. If r and s are not both integers in the interval [1, n − 1], output “invalid” and stop.
    2. Use the hash function established during the setup procedure to compute the hash value:
    H = Hash(M)
    of length hashlen octets as specified in Section 3.5. If the hash function outputs “invalid”,
    output “invalid” and stop.
    3. Derive an integer e from H as follows:
    3.1. Convert the octet string H to a bit string H using the conversion routine specified in
    Section 2.3.2.
    3.2. Set E = H if dlog2 ne 8(hashlen), and set E equal to the leftmost dlog2 ne bits of H
    if dlog2 ne < 8(hashlen).
    3.3. Convert the bit string E to an octet string E using the conversion routine specified in
    Section 2.3.1.
    3.4. Convert the octet string E to an integer e using the conversion routine specified in
    Section 2.3.8.
    4. Compute:
    u1 = es−1 mod n and u2 = rs−1 mod n.
    5. Compute:
    R = (xR, yR) = u1G + u2QU.
    If R = O, output “invalid” and stop.
    6. Convert the field element xR to an integer xR using the conversion routine specified in Section
    2.3.9.
    Page 46 of 138 §4 Signature Schemes
    SEC 1 Ver. 2.0 4.1 Elliptic Curve Digital Signature Algorithm
    7. Set v = xR mod n.
    8. Compare v and r — if v = r, output “valid”, and if v 6= r, output “invalid”.
    The optional input of extra information used to recover R efficiently from r is not used in the actions
    above. Nevertheless, it may be used in an equivalent sequence of actions to achieve more efficient
    verification. For example, if one recovers R from r, then one may verify that sR = eG+rQU. More
    generally, one may choose some integer t, and verify that tsR = teG+trQU. A t can be chosen so
    that both the integers (ts mod n) and (tr mod n) have size approximately
    p
    n, which can be used
    to make the verification operation faster.

    (From page 46 of your document)

    This is the way to follow to verify a signature. The problems are that I can't find some values:

    -n

    -yR

    -G

    -e

    To calculate v and verify ECDSA we need to know particular values and we may need access to the internals of Nordic library to do this.

Related