tlsfuzzer/python-ecdsa

Generate public from point x, y

yodalee opened this issue · 1 comments

Today I am trying to verify the test dataset from CAVP.
I encounter a problem that I cannot generate VerifyingKey using the point x and y provided in hex format.
The test dataset is like:

COUNT = 0
QCAVSx = 42ea6dd9969dd2a61fea1aac7f8e98edcc896c6e55857cc0
QCAVSy = dfbe5d7c61fac88b11811bde328e8a0d12bf01a9d204b523
dIUT = f17d3fea367b74d340851ca4270dcb24c271f445bed9d527
QIUTx = b15053401f57285637ec324c1cd2139e3a67de3739234b37
QIUTy = f269c158637482aad644cd692dd1d3ef2c8a7c49e389f7f6
ZIUT = 803d8ab2e5b6e6fca715737c3a82f7ce3c783124f6d51cd0

which I tried to create the VerifyingKey from QCAVSx and QCAVSy. Below is what I tried:

pnt = ecdsa.ellipticcurve.Point(
    curve = ecdsa.NIST192p,
    x = "42ea6dd9969dd2a61fea1aac7f8e98edcc896c6e55857cc0",
    y = "dfbe5d7c61fac88b11811bde328e8a0d12bf01a9d204b523")
pk = ecdsa.VerifyingKey.from_public_point(pnt)

Which will give me the error of AttributeError: 'Curve' object has no attribute 'contains_point'

Did I make something wrong? or maybe the package does not support this kind of key generation.

Answer the question by myself:
I can generate the VerifyingKey using:

pk = VerifyingKey.from_string(bytes.fromhex(
    "42ea6dd9969dd2a61fea1aac7f8e98edcc896c6e55857cc0dfbe5d7c61fac88b11811bde328e8a0d12bf01a9d204b523"
), curve = NIST192p)

Thank for the great work.