6
$\begingroup$
  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:
      ad:74:6e:1d:3b:62:8b:a7:9b:98:59:f7:41:e0:82:
      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?

$\endgroup$

1 Answer 1

3
$\begingroup$

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 ~ dquote>   ad:74:6e:1d:3b:62:8b:a7:9b:98:59:f7:41:e0:82:
firas@aoba ~ dquote>   54:2a:38:55:02:f2:5d:bf:55:29:6c:3a:54:5e:38:
firas@aoba ~ dquote>   72:76:0a:b7:36:17:de:4a:96:26:2c:6f:5d:9e:98:
firas@aoba ~ dquote>   bf:92:92:dc:29:f8:f4:1d:bd:28:9a:14:7c:e9:da:
firas@aoba ~ dquote>   31:13:b5:f0:b8:c0:0a:60:b1:ce:1d:7e:81:9d:7a:
firas@aoba ~ dquote>   43:1d:7c:90:ea:0e:5f"
firas@aoba ~ % python -c "print 0x$(printf $foo | tr -d ': \n' | tail -c +3 | head -c 96)"
26247035095799689268623156744566981891852923491109213387815615900925518854738050089022388053975719786650872476732087
firas@aoba ~ % python -c "print 0x$(printf $foo | tr -d ': \n' | tail -c +3 | tail -c 96)"
8325710961489029985546751289520108179287853048861315594709205902480503199884419224438643760392947333078086511627871
$\endgroup$
3
  • $\begingroup$ Where is the "04" documentation? By the way, you're a life-saver. $\endgroup$ Commented Apr 27, 2016 at 13:51
  • 1
    $\begingroup$ @AndyNovocin As mentioned in man ecparam, see RFC3279 and its references (notably ANSI X9.62-1998). $\endgroup$
    – fkraiem
    Commented Apr 27, 2016 at 14:13
  • $\begingroup$ Thanks, I found it. If anyone else is curious it's specified in Section 4.3.7 of X9.62-1998. $\endgroup$ Commented Apr 28, 2016 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.