Openssl EVP to implement RSA and SM2 en/dec sign/verify

Using the EVP interface in openssl to implement RSA and SM2 encrypt decrypt sign and verify (C lauguage)

0. Abstract

Openssl provides a series of interfaces that name is EVP structure. Using the interfaces, it is pretty convenient to implement these algorithm of asymmetric RSA or SM2 encryption decryption signature and verification. This paper sorted out the usage of OPENSSL EVP C-lauguage interface, and implement the SM2 and RSA encrypt decrypt signature and verify. Combining with the code, this paper introduced the related functions of RSA and SM2 algorithm. Finally, ran the program to test module functions.

1. RSA

1.1 What is RSA.

1.2 RSA gen .pem file(key pairs)

1.3 RSA encrypt

1.4 RSA decrypt

1.5 RSA signature

1.6 RSA verify

2. SM2

2.1 What is SM2

2.2 SM2 gen .pem file(key pairs)

2.3 SM2 encrypt

2.4 SM2 decrypt

2.5 SM2 signature

2.6 SM2 verify