Score:0

Help determine points on P-256 lie on the actual curve

gb flag

The curve equation for P-256 is:

NIST P-256

y^2 = x^3-3x+41058363725152142129326129780047268409114441015993725554835256314039467401291

Below I am generating key data, including the secret key "d".

Can someone please help me:

1-Convert and plug in the 2 points below into the above equation to ensure the points lie on the curve.

2-Show me, using the curve equation above, how I can determine that x+y will land back on the curve as d, all values shown below?

Use jwcrypto to generate key data

key_data = jwk_crypto.JWK.generate(kty='EC', crv='P-256')

private_key_data = key_data.export(as_dict=True)

print(json.dumps(private_key_data, indent=2))

===>

{

'kty': 'EC',

'crv': 'P-256',

'x': 'vddm_d3R2dYNICxh2D93hjBZyEbpIWSW0fhPUXhHCgc',

'y': 'BjcTCjAp6oqDRbWDSCiCMxSKMDEAe4rAwYJqXHEbO98',

'd': 'B_nLv2KHBVUZEx6KSNULf3ZqZlYaVrpp8J7ncORbS_U'

}

kelalaka avatar
in flag
Welcome to Cryptography.SE. First, your question is not totally clear. Second, coding-related issues even they are related to cryptography are off-topic here. You should ask in [so] with proper tags and include where you failed. We accept some coding to explain the problem on the Cryptographic side, not on the programmatic side.
kelalaka avatar
in flag
Note that with secret key $d$ one calculates the public key $[d]G$ where $G$ is generator of the curve group and this is called the scalar multiplication meaning add $G$ d-times.
kelalaka avatar
in flag
Are you asking similar to this? [Proof that user public key corresponds the curve equation (secp256r1)](https://crypto.stackexchange.com/q/85800/18298)
gb flag
The link you sent uses hex X Y inputs. How do I convert above to Hex first in order to feed to the equation - Or I would have assumed it needs to be converted to Integers first?
kelalaka avatar
in flag
SageMath accepts hex values as integer inputs, which depends on the programming language that you use.
gb flag
The one in the question is what format do you think?
gb flag
Also can you let me know if the given X and Y is the first point, then where is the second point defined? And also how does the d: fit in the output at the end?
kelalaka avatar
in flag
Those are Base64 encoded [try here to get hex without a seperator](https://www.rapidtables.com/web/tools/base64-decode.html) and your point is a valid point and the public key of $d$ i.e $[d]G$ has coordinates as $(x,y)$. What is 2 points what is the second question.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.