The function EVP_PKEY_CTX_set_sm2_encdata_format() sets the format of the encrypted data generated during SM2 encryption. SM2 is a cryptographic algorithm used for digital signature and key exchange in Chinese cryptography standards. The format of the encrypted data determines how the encrypted data is represented, which affects how it is processed and transmitted.

The function takes two arguments: the EVP_PKEY_CTX object and the format identifier. The format identifier can be one of the following:

  • EVP_PKEY_SM2_ENC_MODE_EXPLICIT: This format represents the encrypted data in an explicit manner, which means that the ciphertext and the ephemeral public key used for encryption are both included in the output. This format is more verbose, but it provides more information about the encrypted data.

  • EVP_PKEY_SM2_ENC_MODE_IMPLICIT: This format represents the encrypted data in an implicit manner, which means that only the ciphertext is included in the output. The ephemeral public key used for encryption is not included. This format is less verbose, but it provides less information about the encrypted data.

By default, the format is set to EVP_PKEY_SM2_ENC_MODE_EXPLICIT. The format can be changed using EVP_PKEY_CTX_set_sm2_encdata_format(). This function should be called before EVP_PKEY_encrypt_init() is called

EVP_PKEY_CTX_set_sm2_encdata_format

原文地址: https://www.cveoy.top/t/topic/cfYl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录