I am using the RSA_generate_keys to generate an RSA * structure. I wish to pack or serialize all the information in this structure into an array of bytes and then deserialize it back into an RSA * structure later on. What is the best way to do this?
I have a couple of options I have explored: 1. Use BIGNUM conversion to array functions. This doesn't seem like it will work with negative numbers. Also the other members in the RSA structure would take a long time to serialize like the RSA_METHOD variable and ENGINE variable. 2. Possibly converting RSA to PEM or some other format and then converting back. However, I do not know if this is a lossless conversion? Ie. Will I get my RSA struct back the way it was? Any help would be appreciated. Thanks!