pyopenssl icon indicating copy to clipboard operation
pyopenssl copied to clipboard

src/OpenSSL/crypto.py: support SM2 sign with OpenSSL 1.1.1x

Open hustliyilin opened this issue 2 years ago • 7 comments

In openssl 1.1.1 docs/man3/EVP_PKEY_set1_RSA.pod (https://github.com/openssl/openssl/blob/OpenSSL_1_1_1/doc/man3/EVP_PKEY_set1_RSA.pod) The EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2) API is possible to convert it to using SM2 algorithms After loading an ECC key.

Besides, pyca/cryptography support to export The EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2) API in https://github.com/pyca/cryptography/commit/c28bfb352ab1f390900ef92856a9570aadd5fe2c .

So in pyopenssl, we can support SM2 sign with OpenSSL 1.1.1x and pyca/cryptography.

Fixes: #1171 Signed-off-by: YiLin.Li [email protected]

hustliyilin avatar Dec 28 '22 08:12 hustliyilin

Hi, CI/CD still has a failing check. I don't know what caused it and how to fix it. Can you give me some help or tips?

hustliyilin avatar Feb 28 '23 01:02 hustliyilin

It's caused by the reduction in coverage since there are no tests for this code.

alex avatar Feb 28 '23 01:02 alex

It's caused by the reduction in coverage since there are no tests for this code.

OK, thanks @alex , I will add the tests for this codes as soon as possible.

hustliyilin avatar Feb 28 '23 01:02 hustliyilin

Hello @alex ,

I added the tests and rebased the latest codes already. Besides, I downloaded the corresponding CI/CD (py36-ubuntu20.04) docker image (ghcr.io/pyca/cryptography-runner-ubuntu-bionic:latest) on my machine. I used pip3 install pyopenssl and coverage run --parallel -m pytest -v to test in the CI/CD image locally. The results showed that my new tests were OK. This is a screenshot of my test results

image

However, the CI/CD still has the failing checks. I don't quite know why. Could you help me? Thanks a lot.

image

hustliyilin avatar Mar 02 '23 11:03 hustliyilin

Many of the jobs in our CI run against versions of cryptography compiled against other OpenSSL versions. These do not have SM2 support, so the test suite needs to properly detect support and skip if it isn’t available.

reaperhulk avatar Mar 02 '23 12:03 reaperhulk

@alex ,

Now all CI/CDs passed. Could you review it again? Thanks a lot.

hustliyilin avatar Apr 23 '23 12:04 hustliyilin

Still waiting for this pr to work, mates.

mr-m0nst3r avatar Aug 03 '23 11:08 mr-m0nst3r