The problem is the PEM_write_bio_RSAPrivateKey signature used in the NativeCall declaration, it missed five arguments.
>From the manual:
int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,
unsigned char *kstr, int klen,
pem_password_cb *cb, void *u);
So when called it received random values.
My modernized example attached that succeds.
nativessl.p6
Description: Binary data
