In the openssl library, I can see two methods for writing the public key to a file:
int PEM_write_RSAPublicKey(FILE *fp, RSA *x); int PEM_write_RSA_PUBKEY(FILE *fp, RSA *x);
In the documentation, I see:
RSAPublicKey functions process the RSA public key using the RSA composition. The public key is encoded using the PKCS # 1 RSAPublicKey structure.
RSA_PUBKEY functions also process the RSA public key using the RSA composition. However, the public key is encoded using the SubjectPublicKeyInfo structure and an error occurs if the public key is not RSA
But I do not understand what is
SubjectPublicKeyInfo
And what are the main differences between the two methods!
source share