Hi,

I have done the RSA encryption program. Now I want to convert that encrypted
message to BASE64 message inorder to send the message via socket.
I am trying the following sample code which converts "Hello World" to Base64
format and *printing in console* ( stdout).

*How can I use the funtion "BIO_new_fp(stdout, BIO_NOCLOSE)" to print the
value to another character array instead of "stdout"? If not this,
which Bio_ function I can use so that it will convert to Base64 and put it
in char buffer ?? *
**
#include <stdio.h>
#include <openssl/bio.h>
#include <openssl/evp.h>

int main(int argc, char *argv[])
{
 printf("Hello, world\n");
 BIO *bio, *b64;
 char message[] = "Hello World \n";
  b64 = BIO_new(BIO_f_base64());
 bio = BIO_new_fp(stdout, BIO_NOCLOSE);
 //bio = BIO_new_mem_buf(
 bio = BIO_push(b64, bio);
 BIO_write(bio, message, strlen(message));
 BIO_flush(bio);
 BIO_free_all(bio);

 return 0;
}

Thanks,
Pattabi.

Reply via email to