'How to convert CommonCrypto struct _CCRSACryptor* to openssl RSA?

So I generate a RSA key pair using CommonCrypto like this:

struct _CCRSACryptor* privateKey;
struct _CCRSACryptor* publicKey;
CCRSACryptorGeneratePair(4096, 65537, &publicKey, &privateKey);

How can I convert this key pair into an openssl RSA structure using openssl 3.0?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source