RSA-OAEP with SHA -256 key size of 2048 bits using OpenSSL

I am trying to use the use case just like How to encrypt data using RSA, with SHA-256 as a hash function and MGF1 as a mask generation function? but I need some more clarity.

The above request was raised in 2013. At that time, OpenSSL only supported the SHA1 hash (hard-coded) to complement OAEP. In the latest version of OpenSSL (1.0.2k), I see that this is fixed using the following API:

int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
                                    const unsigned char *from, int flen,
                                    const unsigned char *param, int plen,
                                    const EVP_MD *md, const EVP_MD mgf1md)

RSA_public_encrypt()does not accept structure EVP_MDas an argument. I am not sure how to specify it.

How can I call SHA-256 mode RSA_public_encrypt()using the mask generation function?

+4
source share

Source: https://habr.com/ru/post/1670422/


All Articles