Topic: [SOLVED] Public Key verification

Hi,

I'm trying to implement an API to parse raw data of public key to EC_POINT struct and verify that this key exists on the given curve.
I know that wolfSSL_ECPoint_d2i() do the parsing.

How can I verify that the key is really valid one with the given curve?

Thanks,
Mohammad

Share

Re: [SOLVED] Public Key verification

Hi mohammad,

To verify a given key you would use the API

wc_ecc_check_key(ecc_key* key);

which takes just the key as an argument. There is no need to extract curve/point for this.

A given point is not tied to any one curve, so to validate a key with a given point you need to already know which curve is being used to validate against. Therefore a curve can not be derived from a given point.

Could you tell us a little more about your project and the need to parse point to struct before calling "wc_ecc_check_key"?


Warm Regards,

Kaleb

Re: [SOLVED] Public Key verification

Thanks for the asnwer, My project is to design an API that can be generic API (not platform specific) for cryptographic functions.
WolfSSL is one of the main platforms that I need to support in the future and implement the APIs for it.

so I propused an API which accept binary data of the private key, binary data for the public key and the Curve.
As much as I know, public key validation is done over a given curve.

so the ecc_key struct contains parameters which is related to the curve, so as I can see from the code that the ecc_key
I'll create from the binary data, will be related to some Curve.

according to the wc_ecc_check_key(ecc_key* key) implementation it does check the given key with the curve already exist in the ecc_key object.

Thanks alot for the answer, you helped a lot,
Mohammad

Share

Re: [SOLVED] Public Key verification

Hi mohammad,

If my understanding of your question was off I apologize. I am happy to hear the suggested API addressed your needs.


Warm Regards,

Kaleb