This is the same person as viper49946. A quick update. I may have my method wrong.
I start with the public key from the cryptochip:
uint8_t publicKeyExternal[64] = {
0xF9, 0xC3, 0x6F, 0x89, 0x64, 0x62, 0x33, 0x78, 0xBD, 0xC0, 0x68, 0xD4, 0xBC, 0xE0, 0x7E, 0xD1,
0x7C, 0x8F, 0xA4, 0x86, 0xF9, 0xAC, 0x0C, 0x26, 0x13, 0xCA, 0x3C, 0x8C, 0x30, 0x6D, 0x7B, 0xB6,
0x1C, 0xD3, 0x67, 0x17, 0xB8, 0xAC, 0x5E, 0x4F, 0xEA, 0x8A, 0xD2, 0x3D, 0xC8, 0xD0, 0x78, 0x3C,
0x23, 0x18, 0xEE, 0x4A, 0xD7, 0xA8, 0x0D, 0xB6, 0xE0, 0x02, 0x6A, 0xD0, 0xB0, 0x72, 0xA2, 0x4F
};
I compress the byte array in hex to two 32 byte hex strings:
[‘f9c36f8964623378bdc068d4bce07ed17c8fa486f9acc2613ca3c8c306d7bb6’, ‘1cd36717b8ac5e4fea8ad23dc8d0783c2318ee4ad7a8db6e026ad0b072a24f’]
I guess that these are the {x,y} coordinates of an uncompressed public key. I convert them to int values
{7060700267049620596356235336501166570879242195065472674169415375238145604534 , 50930765665627190067685409014485724477345323970126409943904502612080370255}
I they feed them into a library. In this case, the fastecdsa SEC1Encoder.encode_public_key method.
fastecdsa tells me that the point is not on the curve. Pulling in a public key for the P-256 curve from a stackoverflow post does not produce this error message (suggesting that it is on the curve, the library is working, but there is something
wrong with the input in the form Point(x,y,Curve=P256)
Point(7060700267049620596356235336501166570879242195065472674169415375238145604534 , 50930765665627190067685409014485724477345323970126409943904502612080370255,Curve=P256)
Assuming that the public key from the cryptochip is a good one (whatever good means) then there must be something wrong in my method of compressing the byte array into a hex string and then an x,y integer .
Here is a link to a gist where I describe things in more detail:
https://gist.github.com/bshambaugh/6f0f … 4cc103e9c4