Goodmorning, i'm trying to write an easy program to test the base64 BIO filter but it seems it doesn't work. In particular if i push the bio64, i read a little amount of data and i pop the bio64 the read in the middle fail ( return 0 ). This doens't happen if the text to read is a lot.
This is a little example: #include <openssl/evp.h> #include <stdio.h> #include <string.h> int main() { BIO *in, *out, *b64; char str[50]; int str_len; out=BIO_new(BIO_s_file()); BIO_write_filename(out,"./file"); b64=BIO_new(BIO_f_base64()); BIO_puts(out,"FIRST STRING\n"); out=BIO_push(b64,out); BIO_write(out,"short string\n",strlen("short string\n")); BIO_flush(out); out=BIO_pop(b64); BIO_puts(out,"SECOND STRING\n"); out=BIO_push(b64,out); BIO_write(out,"short string\n",strlen("short string\n")); BIO_flush(out); out=BIO_pop(b64); BIO_free(out); system("pause"); in=BIO_new(BIO_s_file()); BIO_read_filename(in,"./file"); str_len=BIO_read(in,str,strlen("PRIMA STRINGA\n")); printf("\n%s - %d\n",str,str_len); in=BIO_push(b64,in); str_len=BIO_read(in,str,strlen("stringa di prova\n")); //this read returns 0 printf("\n%s - %d\n",str,str_len); in=BIO_pop(b64); BIO_read(in,str,strlen("SECONDA STRINGA\n")); in=BIO_push(b64,in); BIO_read(in,str,strlen("stringa di prova\n")); //this read returns 0 in=BIO_pop(b64); printf("\n%s\n",str); } ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]