I have a Public key in CNG (BCRYPT_KEY_HANDLE)
, and I need to know the curve it uses. I tried BCryptGetProperty with BCRYPT_ALGORITHM_NAME
parameter, but it only gives ECDH_P256
back, not the exact curve type. I need to know if its prime256v1 or secp256k1 or secp256r1
curve, because they aren't compatible with each other.
Asked
Active
Viewed 483 times
-1

Mark Amery
- 143,130
- 81
- 406
- 459

Zsolt Czikó
- 1
- 1
1 Answers
0
Check out RFC 4492: - "Appendix A. Equivalent Curves (Informative)".
NIST P-256
is also known as secp256r1
and prime256v1
.
ECDH_P256
is therefore prime256v1
& P-256
& secp256r1
!
They are all the same.
secp256k1
is a different curve entirely, used most notably in Bitcoin.

Mark Amery
- 143,130
- 81
- 406
- 459

Woodstock
- 22,184
- 15
- 80
- 118
-
This isn't true. If you checkout the RFC you can see, that secp256r1 and prime256v1 are the same, but secp256k1 are different from them. The question was to get information by using CNG about the curve of the key. Is there any way to do this? – Zsolt Czikó Feb 04 '21 at 07:29
-
@ZsoltCzikó that was a typo! Fixed! - thanks for highlighting my error :) – Woodstock Feb 04 '21 at 10:15
-
@ZsoltCzikó as your key is `P256` you can be assured its using the `secp256r1` curve. – Woodstock Feb 04 '21 at 10:17