libder_write.3
1 .\" 2 .\" SPDX-Copyright-Identifier: BSD-2-Clause 3 .\" 4 .\" Copyright (C) 2024 Kyle Evans <kevans@FreeBSD.org> 5 .\" 6 .Dd March 2, 2024 7 .Dt LIBDER_WRITE 3 8 .Os 9 .Sh NAME 10 .Nm libder_write 11 .Nd writing DER encoded buffers 12 .Sh LIBRARY 13 .Lb libder 14 .Sh SYNOPSIS 15 .In libder.h 16 .Ft uint8_t * 17 .Fn libder_write "struct libder_ctx *ctx" "struct libder_object *root" "uint8_t *buf" "size_t *bufsize" 18 .Sh DESCRIPTION 19 The 20 .Fn libder_write 21 writes the specified 22 .Fa root 23 into the given 24 .Fa buf 25 of size 26 .Fa bufsize . 27 If a 28 .Dv NULL 29 and 30 .Dv 0 31 are passed in, then 32 .Fn libder_write 33 will alllocate a buffer just large enough to fit the encoded 34 .Fa root . 35 Upon successful write, 36 .Fn libder_write 37 will return a pointer to the buffer used, and 38 .Fa *bufsize 39 is updated to indicate how many bytes were written. 40 On failure, 41 .Dv NULL 42 is returned and 43 .Fa *bufsize 44 will remain unmodified. 45 .Pp 46 Normalization rules are applied at write time, if specified via 47 .Xr libder_set_normalize 3 . 48 Note that applications do not typically need to enable normalization, as they 49 are all enabled by default. 50 .Sh SEE ALSO 51 .Xr libder 3 , 52 .Xr libder_obj 3 , 53 .Xr libder_read 3 , 54 .Xr libder_type 3