Hello Fabian,
In the newest version of CryptoAPI you can use the RSA_NewKey function to generate a private key and it will be used in combination with the RSA_GetPublicKey to encrypt/decrypt

So, instead of using the old GenerateAESKey function you will need to use the RSA_NewKey and update your logic a bit

Regards,
Bogdan