简体   繁体   中英

How to get Qx and Qy form DER Encoded EC_POINT

I created a brainpool EC on a nitro key hsm and want to use this for crypto operations with the .NET Framework eg System.Security.Cryptography.ECDiffieHellman .

I extracted with pkcs11-tool --list-objects the public key but get only one value , the EC_POINT.

So, how to I get the coordinate of this point?

DER Encoded EC_POINT

Public Key Object; EC  EC_POINT 320 bits
  EC_POINT:   0451040defed7988b095679e5aca422382d949c2e7fd937646def25cf7eb5140d41f12d077ac615773952da53efad266c8642c6877b8b215d091ba687acafd3c33f35ffb5ca6aadaf248ef1a126cd55e0d0598
  EC_PARAMS:  06092b2403030208010109
  label:      Brainpool #1
  ID:         10
  Usage:      verify

Decoded EC_POINT

This EC_POINT is DER encoded, I used this to extract the true value of the EC_POINT.

040defed7988b095679e5aca422382d949c2e7fd937646def25cf7
eb5140d41f12d077ac615773952da53efad266c8642c6877b8b215
d091ba687acafd3c33f35ffb5ca6aadaf248ef1a126cd55e0d0598

(Or this JS Script https://lapo.it/asn1js/#0451040DEFED7988B095679E5ACA422382D949C2E7FD937646DEF25CF7EB5140D41F12D077AC615773952DA53EFAD266C8642C6877B8B215D091BA687ACAFD3C33F35FFB5CA6AADAF248EF1A126CD55E0D0598 )

040defed7988b095679e5aca422382d949c2e7fd937646def25cf7
eb5140d41f12d077ac615773952da53efad266c8642c6877b8b215
d091ba687acafd3c33f35ffb5ca6aadaf248ef1a126cd55e0d0598

Is your public key. The first byte indicates that it is an uncompressed key ( 04 ), which means that of the remaining bytes, the first half are the X coordinate and the second half are the Y coordinate.

Qx = 0defed7988b095679e5aca422382d949c2e7fd937646def25cf7eb5140d41f12d077ac615773952d

Qy = a53efad266c8642c6877b8b215d091ba687acafd3c33f35ffb5ca6aadaf248ef1a126cd55e0d0598

http://www.secg.org/sec1-v2.pdf , section 2.3.4 (Octet-String-to-Elliptic-Curve-Point Conversion).

(And since the parameters ( 06092b2403030208010109 ) is the DER-oid 1.3.36.3.3.2.8.1.1.9 (brainpoolP320r1) everything looks correct, since Qx/Qy are 320-bit values)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM