1.\" $OpenBSD: BIO_dump.3,v 1.4 2022/12/20 15:34:03 schwarze Exp $ 2.\" 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: December 20 2022 $ 18.Dt BIO_DUMP 3 19.Os 20.Sh NAME 21.Nm BIO_dump , 22.Nm BIO_dump_indent , 23.Nm BIO_dump_fp , 24.Nm BIO_dump_indent_fp 25.\" intentionally undocumented because nothing uses these two functions: 26.\" .Nm BIO_dump_cb 27.\" .Nm BIO_dump_indent_cb 28.Nd hexadecimal printout of arbitrary byte arrays 29.Sh SYNOPSIS 30.In openssl/bio.h 31.Ft int 32.Fo BIO_dump 33.Fa "BIO *b" 34.Fa "const char *s" 35.Fa "int len" 36.Fc 37.Ft int 38.Fo BIO_dump_indent 39.Fa "BIO *b" 40.Fa "const char *s" 41.Fa "int len" 42.Fa "int indent" 43.Fc 44.Ft int 45.Fo BIO_dump_fp 46.Fa "FILE *fp" 47.Fa "const char *s" 48.Fa "int len" 49.Fc 50.Ft int 51.Fo BIO_dump_indent_fp 52.Fa "FILE *fp" 53.Fa "const char *s" 54.Fa "int len" 55.Fa "int indent" 56.Fc 57.Sh DESCRIPTION 58.Fn BIO_dump 59prints 60.Fa len 61bytes starting at 62.Fa s 63to 64.Fa bio 65in hexadecimal format. 66.Pp 67The first column of output contains the index, in the byte array starting at 68.Fa s , 69of the first byte shown on the respective output line, expressed as a 70four-digit hexadecimal number starting at 0000, followed by a dash. 71After the dash, sixteen bytes of data are printed as two-digit 72hexadecimal numbers, respecting the order in which they appear in 73the array 74.Fa s . 75Another dash is printed after the eighth column. 76.Pp 77To the right of the hexadecimal representation of the bytes, 78the same bytes are printed again, this time as ASCII characters. 79Non-printable ASCII characters are replaced with dots. 80.Pp 81Trailing space characters and NUL bytes are omitted from the main table. 82If there are any, an additional line is printed, consisting of the 83.Fa len 84argument as a four-digit hexadecimal number, a dash, and the fixed string 85.Qq <SPACES/NULS> . 86.Pp 87.Fn BIO_dump_indent 88is similar except that 89.Fa indent 90space characters are prepended to each output line. 91If 92.Fa indent 93is 7 or more, the number of data columns is reduced such that the 94total width of the output does not exceed 79 characters per line. 95.Pp 96.Fn BIO_dump_fp 97and 98.Fn BIO_dump_indent_fp 99are similar except that 100.Xr fwrite 3 101is used instead of 102.Xr BIO_write 3 . 103.Sh RETURN VALUES 104On success these functions return the total number of bytes written by 105.Xr BIO_write 3 106or 107.Xr fwrite 3 . 108If a failure occurs at any point when writing, these 109functions will stop after having potentially written out partial results, 110and return -1. 111.Sh SEE ALSO 112.Xr hexdump 1 , 113.Xr BIO_new 3 , 114.Xr BIO_write 3 115.Sh HISTORY 116.Fn BIO_dump 117first appeared in SSLeay 0.6.5 and has been available since 118.Ox 2.4 . 119.Pp 120.Fn BIO_dump_indent 121first appeared in OpenSSL 0.9.6 and has been available since 122.Ox 2.9 . 123.Pp 124.Fn BIO_dump_fp 125and 126.Fn BIO_dump_indent_fp 127first appeared in OpenSSL 0.9.8 and have been available since 128.Ox 4.5 . 129