Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SM2 Algorithm Support #131

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,16 @@ <h3>Multikey</h3>
(`z`).
</td>
</tr>
<tr>
<td>SM2 256-bit public key</td>
<td>
The encoding of a SM2 public key MUST start with the two-byte prefix
xicilion marked this conversation as resolved.
Show resolved Hide resolved
`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 @@ -1489,6 +1499,16 @@ <h3>Multikey</h3>
(`z`).
</td>
</tr>
<tr>
<td>SM2 256-bit secret key</td>
<td>
The encoding of a SM2 secret key MUST start with the two-byte prefix
xicilion marked this conversation as resolved.
Show resolved Hide resolved
`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 @@ -3764,6 +3784,16 @@ <h2>Multikey Examples</h2>
"capabilityInvocation": [
"https://controller.example/123#key-2"
]
}
</pre>

<pre class="example nohighlight"
title="A SM2 public key encoded as a Multikey">
xicilion marked this conversation as resolved.
Show resolved Hide resolved
{
"id": "https://multikey.example/issuer/123#key-0",
"type": "Multikey",
"controller": "https://multikey.example/issuer/123",
"publicKeyMultibase": "zEPJc1vCfbG2aoZn8f3U8ggYRL4ZFfF63ZA3qFSk81WJxnCQr"
}
</pre>
</section>
Expand Down Expand Up @@ -3882,6 +3912,21 @@ <h2>JsonWebKey Examples</h2>
"capabilityInvocation": [
"https://controller.example/123#key-2"
]
}
</pre>

<pre class="example nohighlight"
title="A SM2 public key encoded as a JsonWebKey">
xicilion marked this conversation as resolved.
Show resolved Hide resolved
{
"id": "https://jsonwebkey.example/issuer/123#key-0",
"type": "JsonWebKey",
"controller": "https://jsonwebkey.example/issuer/123",
"publicKeyJwk": {
"kty": "EC",
"crv": "SM2",
"x": "NIMpjy0M25izi2DrQLhQBlL8b45Lt9a0FzfELdpdO0s",
"y": "NXstrSPtSp1cZzvupZ8C68FCgSQhZbuGYLorP6F1N2w"
}
}
</pre>
</section>
Expand Down