3
$\begingroup$

I am trying to understand the FIDO U2F Raw Message Format, especially the format in which a user public key should be provided.

The documentation says the following:

A user public key [65 bytes]. This is the (uncompressed) x,y-representation of a curve point on the P-256 NIST elliptic curve.

I have parsed the following provided key pair in HEX format with the jsrsasign JavaScript library:

// p. 19. l. 340-341
var PUBLIC_KEY = '04b174bc49c7ca254b70d2e5c207cee9cf174820ebd77ea3c65508c26da51b657c1cc6b952f8621697936482da0a6d3d3826a59095daf6cd7c03e2e60385d2f6d9';

// p. 19 l. 338
var PRIVATE_KEY = '9a9684b127c5e3a706d618c86401c7cf6fd827fd0bc18d24b0eb842e36d16df1';

This gives me access to (hopefully) all relevant data for this keypair:

- ecparams
    - G:ECPointFp
        - curve:ECCurveFp
            - a:ECFieldElementFp
                - q:BigInteger
                - x:BigInteger
            - b:ECFieldElementFp
                - q:BigInteger
                - x:BigInteger
            - q:BigInteger
        - x:ECFieldElementFp
            - q:BigInteger
            - x:BigInteger
        - y:ECFieldElementFp
            - q:BigInteger
            - x:BigInteger
        - z:BigInteger
    - curve:ECCurveFp
        - a:ECFieldElementFp
            - q:BigInteger
            - x:BigInteger
        - b:ECFieldElementFp
            - q:BigInteger
            - x:BigInteger
        - q:BigInteger
    - h:BigInteger

However, I am completely lost trying to construct a message of 65 bytes from this information.

$\endgroup$
  • 3
    $\begingroup$ The public key contains octet 04 followed by two 32 byte big endian unsigned integers representing a point on the curve in affine coordinates. 04 is identifier of the uncompressed presentation. Private key is just a big endian integer. Curve parameters are found from e.g. appendix D.2.3 of FIPS 186-4: Digital Signature Standard. $\endgroup$ – user4982 Sep 25 '14 at 16:38
  • 3
    $\begingroup$ The only information in the public key is the X,Y coordinate. That other information is the curve parameters. Those are not stored as part of the key itself. $\endgroup$ – user13741 Sep 25 '14 at 16:42
  • $\begingroup$ That last block shows a rather strange format for EC parameters. Where was it defined? $\endgroup$ – Maarten Bodewes Sep 26 '14 at 9:04
  • $\begingroup$ I have generated the key with jsrsasign kjur.github.io/jsrsasign/api/symbols/… $\endgroup$ – mritz_p Sep 26 '14 at 9:08

Your Answer

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

Browse other questions tagged or ask your own question.