Elliptic-Curves

如何從 OpenSSL 生成的G中提取 ECDH 參數GG[Math Processing Error]G?

  • October 3, 2015
  1. 我正在使用 ECDH 生成 ECDH 公共參數(p、a、b、G、n),我嘗試使用openssl ecparam -in cert.pem -text -noout

對於Generator $ G=(x,y) $ 我得到:

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

我的問題是,如何從這個答案(生成器的 x 座標)和的 y 座標)值。[Math Processing Error] $ x $ [Math Processing Error] $ G $ [Math Processing Error] $ y $ $ G $ 2. 順便說一句:當顯示 ECDH 參數時,我得到一個種子值。有人可以解釋一下這個值有什麼用嗎?

這可能是題外話,因為它實際上是關於 OpenSSL … 對於您的問題 1,您獲得的值是前綴04(表示該點以未壓縮形式表示),後跟 - 和座標發電機。這裡你有 97 個字節,所以去掉第一個字節,然後你就有了兩個座標,每個座標佔 48 個字節。 $ x $ $ y $

firas@aoba ~ % foo=" 04:aa:87:ca:22:be:8b:05:37:8e:b1:c7:1e:f3:20:
firas@aoba ~ dquote> 廣告: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 "p​​rint 0x$(printf $foo | tr -d ': \n' | tail -c +3 | head -c 96)"
26247035095799689268623156744566981891852923491109213387815615900925518854738050089022388053975719786650872476732087
firas@aoba ~ % python -c "p​​rint 0x$(printf $foo | tr -d ': \n' | tail -c +3 | tail -c 96)"
8325710961489029985546751289520108179287853048861315594709205902480503199884419224438643760392947333078086511627871

引用自:https://crypto.stackexchange.com/questions/29563