0

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

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 字段

4

1 回答 1

0

可以像这样生成公钥。

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

  2. 私钥 * 生成点 = 公钥

Nonce 必须是转换为 base64 编码的随机字节。

关于签名,不知道是什么签名。

于 2020-03-27T16:22:36.640 回答