ECDHE Curve25519密钥交换签名和键值字段

时间:2019-12-22 12:22:06

标签: openssl pyopenssl diffie-hellman ecdhe

我有一个API,我需要在其中传递“ KeyMaterial”,根据API Docs,该材料适用于:

Contains the cryptographic parameters that are required to perform End-to-End encryption for sharing the information between the producer and the consumer in a secure manner.

这是他们分享的示例

"KeyMaterial": {
  "cryptoAlg": "ECDHE",
  "curve": "Curve25519",
  "params": "string",
  "DHPublicKey": {
    "expiry": "2018-12-23T11:39:57.153Z",
    "Parameters": "string",
    "KeyValue": "683938505ec529a700fcceab66273d1aa78d494208a4769930f0818872159265"
  },
  "Nonce": "R4s6vNI7I/JfdeA3/6dMMQ==",
  "Signature": "jFJcYCOTVV6iiLPlM7qY+Zz+3PF8oUPFg1byb1GNr+k="
}

他们还提到

“签名”字段:有关更多信息,请参考签名标准:https://www.w3.org/TR/xmldsig-core1/

“ KeyValue”:包含临时公共密钥的值

但是,我对应该如何准确填写这些参数感到困惑。我找不到ECDHE + Curve25519的任何参考实现。谁能解释我究竟如何填写这些参数?如何生成签名字段?和“ DHPublicKey”中的KeyValue字段

1 个答案:

答案 0 :(得分:0)

公共密钥可以这样生成。

  1. 生成X25519私钥:32字节随机

  2. 私钥*生成器点=公钥

随机数必须转换为base64编码。

关于签名,我不知道它是哪种签名。