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

sm2: PKCS#8 tests #848

Merged
merged 1 commit into from
Apr 13, 2023
Merged

sm2: PKCS#8 tests #848

merged 1 commit into from
Apr 13, 2023

Conversation

tarcieri
Copy link
Member

Adds test vectors generated using OpenSSL 1.1.1n:

$ openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:sm2 -out pkcs8-private-key.pem

Public key extracted using:

$ openssl ec -in pkcs8-private-key.pem -pubout -out pkcs8-public-key.pem

Extracted with openssl ec -in pkcs8-private-key.pem -noout -text:

Private-Key: (256 bit)
priv:
    4b:b8:df:50:57:22:29:95:92:cb:ed:42:83:b3:54:
    a1:3f:f5:d3:fe:eb:3a:06:60:c5:bd:f3:c8:7c:55:
    94:99
pub:
    04:08:d7:7a:e0:4c:01:cc:4c:11:04:36:0d:d8:af:
    6b:6f:7d:f3:34:28:3d:7c:1a:6a:fd:56:52:40:7b:
    87:be:e5:01:4e:2a:57:c3:6c:15:0d:16:32:4d:c6:
    64:e3:1e:64:32:35:96:09:c4:e7:98:47:a5:b1:61:
    c8:c7:36:4c:8a
ASN1 OID: SM2

Adds test vectors generated using OpenSSL 1.1.1n:

    $ openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:sm2 -out pkcs8-private-key.pem

Public key extracted using:

    $ openssl ec -in pkcs8-private-key.pem -pubout -out pkcs8-public-key.pem

Extracted with `openssl ec -in pkcs8-private-key.pem -noout -text`:

Private-Key: (256 bit)
priv:
    4b:b8:df:50:57:22:29:95:92:cb:ed:42:83:b3:54:
    a1:3f:f5:d3:fe:eb:3a:06:60:c5:bd:f3:c8:7c:55:
    94:99
pub:
    04:08:d7:7a:e0:4c:01:cc:4c:11:04:36:0d:d8:af:
    6b:6f:7d:f3:34:28:3d:7c:1a:6a:fd:56:52:40:7b:
    87:be:e5:01:4e:2a:57:c3:6c:15:0d:16:32:4d:c6:
    64:e3:1e:64:32:35:96:09:c4:e7:98:47:a5:b1:61:
    c8:c7:36:4c:8a
ASN1 OID: SM2
@tarcieri tarcieri merged commit 852e0cb into master Apr 13, 2023
@tarcieri tarcieri deleted the sm2/pkcs8-tests branch April 13, 2023 22:36
tarcieri added a commit that referenced this pull request Apr 15, 2023
Implements SM2DSA, a digital signature algorithm specified in
GBT.32918.2-2016 as well as draft-shen-sm2-ecdsa.

The implementation draws a lot of inspiration from the `ecdsa` crate,
including the use of RFC6979 for deriving the ephemeral scalar `k`.

Tested against a signature test vector created using OpenSSL 3.0.8 using
the PKCS#8 example keys which were added in #848.
@tarcieri tarcieri mentioned this pull request Apr 15, 2023
tarcieri added a commit that referenced this pull request Apr 15, 2023
Implements SM2DSA, a digital signature algorithm specified in
GBT.32918.2-2016 as well as draft-shen-sm2-ecdsa.

The implementation draws a lot of inspiration from the `ecdsa` crate,
including the use of RFC6979 for deriving the ephemeral scalar `k`.

Tested against a signature test vector created using OpenSSL 3.0.8 using
the PKCS#8 example keys which were added in #848.
tarcieri added a commit that referenced this pull request Apr 15, 2023
Implements SM2DSA, a digital signature algorithm specified in
GBT.32918.2-2016 as well as draft-shen-sm2-ecdsa.

The implementation draws a lot of inspiration from the `ecdsa` crate,
including the use of RFC6979 for deriving the ephemeral scalar `k`.

Tested against a signature test vector created using OpenSSL 3.0.8 using
the PKCS#8 example keys which were added in #848.
tarcieri added a commit that referenced this pull request Apr 15, 2023
Implements SM2DSA, a digital signature algorithm specified in
GBT.32918.2-2016 as well as draft-shen-sm2-ecdsa.

The implementation draws a lot of inspiration from the `ecdsa` crate,
including the use of RFC6979 for deriving the ephemeral scalar `k`.

Tested against a signature test vector created using OpenSSL 3.0.8 using
the PKCS#8 example keys which were added in #848.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant