My client wants me to write a Cocoa code to
- generate a RSA key pair, and then convert it to Microsoft BCRYPT_RSAKEY_BLOB structure;
- convert the Microsoft BCRYPT_RSAKEY_BLOB structure to a RSA key pair useable to en/decrypt.
The BCRYPT_RSAKEY_BLOB structure is described at https://msdn.microsoft.com/en-us/library/windows/desktop/aa375531(v=vs.85).aspx
I went through the Security SecKey... APIs a zillion times, but I can't find a way to do that. Would be really grateful for any help.
I can generate the key pair all right; I can use it for en/decryption. But the only service to get the detailed key information I have found is SecKeyCopyAttributes, and, alas,
(a) I did not find a detailed description of the returned attributes;
(b) checking them in debugger, I can't see there those things the MS jokers want (like exponent, modulus, etc.)
(c) besides, I did not find a way to create a key pair based on the attributes, i.e., an inverse function to SecKeyCopyAttributes;
(d) and what's worse, I would need to support macOSen back to at least 10.10, and SecKeyCopyAttributes seems to be 10.12+.
I have tried to find another APIs for that, but in vain. Can anybody help? Thanks!