Hello, 1) I do not know when must I use pem or der format when I deal with data encoding. For example, now, I have to read DHparam file. I created it with command line. I chose DHparam.pem because PEM is commonly used...
2) So, I am looking for PEM encode/decode functions which help me to perform this scheme : a) read DHparam.pem -> store it in C structure DH* dh; -> PEM_encode(dh, char* data) -> send_data_to_peer(sock, *data) b) recv_data_from_peer(sock, *data) -> PEM_decode(dh, char* data) But PEM encode/decode functions are not documented . I found : DH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u); I 'm wondering why it returns DH* ...? I guess it put result in DH** I do not know how to use this function. 3) I found DER encode/decode function in the doc : DH * d2i_DHparams(DH **a, unsigned char **pp, long length); int i2d_DHparams(const DH *a, unsigned char **pp); For the moment, despite the fact that I intend to use PEM encode/decode function, I am going to use DER one's. to summarize: -- is PEM format adequate to send data to peer ? so how to use these PEM functions : http://www.openssl.org/docs/crypto/pem.html -- Any way, for the moment I am going to use DER encode/decode functions. So I have to convert DHparam.pem into DHparam.der so that I can read it with DER function. ( does d2i_ read PEM format ..? ) Thanks for your help.