Hello, [EMAIL PROTECTED] wrote on 06/25/2008 04:34:07 PM:
> [EMAIL PROTECTED] ha scritto: > > Hello, > > > > [EMAIL PROTECTED] wrote on 06/25/2008 04:10:45 PM: > > > > > >> Hi, > >> i'm creating a little client/server program using C. i need to read a > >> rsa from pem file (so using PEM_read_RSAPublicKey) and then send the > >> key to a server (the message can be only a string type) which reads a > >> rsa public key from another pem file and return, comparing keys, is are > >> egual or not. > >> > > What about just reading your .pem file with simple read() to char table > > and send this to server ? > > > > Best regards, > > -- > > Marek Marcola <[EMAIL PROTECTED]> > > > > ______________________________________________________________________ > > OpenSSL Project http://www.openssl.org > > User Support Mailing List openssl-users@openssl.org > > Automated List Manager [EMAIL PROTECTED] > > > Yes of course. But nothing more elegant ? I do not think that in this case are more elegant solutions ... .... but you can try: You may create memory BIO: BIO *mem; if ((mem = BIO_new(BIO_s_mem())) == NULL) { goto err; } Write public key to this bio: if (PEM_write_bio_PUBKEY(mem, key) == 0) { BIO_free(mem); goto err; } and read to buffer in PEM format: if ((n = BIO_read(mem, buf, *len)) <= 0) { BIO_free(mem); goto err; } BIO_free(mem); This code is not tested nor checked, hope this helps. Best regards, -- Marek Marcola <[EMAIL PROTECTED]> ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]