Hi, I am unable to write to a file using PEM_write_X509. Im
running my program on linux. The functions works when the file pointer is
stdout. It fails when any other valid file pointer is used. This is the same
problem with BIO_printf. If the output BIO is stdout it works but doesn’t
write into a file pointer supplied by the program. Im pasting sample code
below: FILE *fp1 = NULL; if((fp1 = fopen (“test”,
"rw"))== NULL){ printf
("opening %s \n", 's', "test failed"); } X509* x509 int i = PEM_write_X509(stdout, x509);
//works fine and prints the certificate on the screen int
j = PEM_write_X509(fp1, x509 ); //doesn’t work The file has all required permissions and the file is being
opened. This is the same problem with BIO_printf, PEM_write_Privatekey. BIO_printf(BIO* b, “Some text\n”); When b – stdout in BIO wrapper it works but with file
pointer in BIO wrapper “Some text” is not written into the file. Has anyone encountered this problem? Regards Aparna
|