Hi,
Am 20.08.2010 11:33, schrieb Guenter via RT:
while hacking on a script where I use the openssl commandline tool for
processing PEM certs I found that suprisingly the md5 fingerprint output
always goes to stdout instead of using the -out stream, f.e. when using:
openssl x509 -md5 -fingerprint -text -inform PEM -in tmpin.crt -out
tmpout.crt
the md5 fingerprint output goes to stdout while the whole rest of output
goes into tmpout.crt as expected ...
is this now intended behaviour, or just an oversight? If the latter I
would look into the sources for fixing it ...
tested versions:
OpenSSL 0.9.8o 01 Jun 2010
OpenSSL 1.0.0a 1 Jun 2010
I've meanwhile checked apps/x509.c, and patching it to send output to file is trivial (attached); but looking at the other output options around these lines makes me a bit unsure if these options are intended to go to STDOUT rather than to honor a file option? However if the later then I'm asking me why? Almost all options print their output to STDOUT and ignore a file option - except for the text option ...

thanks, Gün.

--- x509.c.orig Fri Jun 26 13:34:21 2009
+++ x509.c      Fri Aug 27 23:32:32 2010
@@ -898,11 +898,11 @@
                                        BIO_printf(bio_err,"out of memory\n");
                                        goto end;
                                        }
-                               BIO_printf(STDout,"%s Fingerprint=",
+                               BIO_printf(out,"%s Fingerprint=",
                                                
OBJ_nid2sn(EVP_MD_type(digest)));
                                for (j=0; j<(int)n; j++)
                                        {
-                                       BIO_printf(STDout,"%02X%c",md[j],
+                                       BIO_printf(out,"%02X%c",md[j],
                                                (j+1 == (int)n)
                                                ?'\n':':');
                                        }
--- x509.c.orig Tue Jan 12 19:27:09 2010
+++ x509.c      Fri Aug 27 23:38:23 2010
@@ -932,11 +932,11 @@
                                        BIO_printf(bio_err,"out of memory\n");
                                        goto end;
                                        }
-                               BIO_printf(STDout,"%s Fingerprint=",
+                               BIO_printf(out,"%s Fingerprint=",
                                                OBJ_nid2sn(EVP_MD_type(fdig)));
                                for (j=0; j<(int)n; j++)
                                        {
-                                       BIO_printf(STDout,"%02X%c",md[j],
+                                       BIO_printf(out,"%02X%c",md[j],
                                                (j+1 == (int)n)
                                                ?'\n':':');
                                        }

Reply via email to