Skip to content

Commit

Permalink
Add SM2 algorithm support.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion authored Dec 29, 2024
1 parent 75dd250 commit 7946f01
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,16 @@ <h3>Multikey</h3>
(`z`).
</td>
</tr>
<tr>
<td>SM2 256-bit public key</td>
<td>
The encoding of an SM2 public key MUST start with the two-byte prefix
`0x8624` (the varint expression of `0x1206`) followed by the 33-byte compressed
public key data. The resulting 35-byte value MUST then be encoded using the
base-58-btc alphabet, according to Section [[[#multibase-0]]], and then
prepended with the base-58-btc Multibase header (`z`).
</td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -1511,6 +1521,16 @@ <h3>Multikey</h3>
(`z`).
</td>
</tr>
<tr>
<td>SM2 256-bit secret key</td>
<td>
The encoding of an SM2 secret key MUST start with the two-byte prefix
`0x9026` (the varint expression of `0x1310`) followed by the 32-byte
secret key data. The resulting 34-byte value MUST then be encoded using the
base-58-btc alphabet, according to Section [[[#multibase-0]]], and then
prepended with the base-58-btc Multibase header (`z`).
</td>
</tr>
</tbody>

</table>
Expand Down Expand Up @@ -3841,6 +3861,16 @@ <h2>Multikey Examples</h2>
"capabilityInvocation": [
"https://controller.example/123#key-2"
]
}
</pre>

<pre class="example nohighlight"
title="An SM2 public key encoded as a Multikey">
{
"id": "https://multikey.example/issuer/123#key-0",
"type": "Multikey",
"controller": "https://multikey.example/issuer/123",
"publicKeyMultibase": "zEPJc1vCfbG2aoZn8f3U8ggYRL4ZFfF63ZA3qFSk81WJxnCQr"
}
</pre>
</section>
Expand Down

0 comments on commit 7946f01

Please sign in to comment.