# How to exctract ECDH parameters from an OpenSSL-generated $G$?

1. I'm using ECDH for generating ECDH public parameters (p,a,b,G,n), I try to get this values using openssl ecparam -in cert.pem -text -noout

For Generator $G=(x,y)$ I get :

Generator (uncompressed):
04:aa:87:ca:22:be:8b:05:37:8e:b1:c7:1e:f3:20:
54:2a:38:55:02:f2:5d:bf:55:29:6c:3a:54:5e:38:
72:76:0a:b7:36:17:de:4a:96:26:2c:6f:5d:9e:98:
bf:92:92:dc:29:f8:f4:1d:bd:28:9a:14:7c:e9:da:
31:13:b5:f0:b8:c0:0a:60:b1:ce:1d:7e:81:9d:7a:
43:1d:7c:90:ea:0e:5f


My question is, how to extract $x$ (the x-coordinate of the generator $G$) and $y$ (the y-coordinate of the generator $G$) values from this answer.

2. by the way: when displaying ECDH parameters I get a seed value. Can someone please explain what this value is useful for?

This may be off-topic since it is really about OpenSSL... For your question 1, the values you get are the prefix 04 (which indicates that the point is represented in uncompressed form) followed by the $x$- and $y$-coordinates of the generator. Here you have 97 bytes, so eliminate the first byte and then you have both coordinates, which take 48 bytes each.

firas@aoba ~ % foo="  04:aa:87:ca:22:be:8b:05:37:8e:b1:c7:1e:f3:20:
firas@aoba ~ % python -c "print 0x$(printf$foo | tr -d ': \n' | tail -c +3 | head -c 96)"
firas@aoba ~ % python -c "print 0x$(printf$foo | tr -d ': \n' | tail -c +3 | tail -c 96)"

• @AndyNovocin As mentioned in man ecparam, see RFC3279 and its references (notably ANSI X9.62-1998). Apr 27 '16 at 14:13