Date: Thu, 2 Aug 2018 22:31:17 -0700 From: Conrad Meyer <cem@freebsd.org> To: Eric McCorkle <eric@metricspace.net> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: A few build system questions Message-ID: <CAG6CVpVGvT=Hp91B_hnTiAxkO85OfbtQSODGXz3VMg%2BJOHrexQ@mail.gmail.com> In-Reply-To: <9c3f08be-2a76-a726-16b2-c1e6a1aa4aa8@metricspace.net> References: <bedd6e76-bbe4-7690-70ed-041bbe7970f7@metricspace.net> <20180802153357.GA25687@spindle.one-eyed-alien.net> <7f143985-2ebb-210a-e314-0deebd3d9f5b@metricspace.net> <CANCZdfpACQP6gypGm_Jp1qQxMpTZT7XoUJnZPQMt7M46cgiqhQ@mail.gmail.com> <7a14aee9-8205-4fc7-a7a0-a9ed2f33751d@metricspace.net> <CANCZdfqFJs_dTc1gXf8=5ZcC=C9HghHU%2Bb0uzfjZkpA__%2B=DjA@mail.gmail.com> <9c3f08be-2a76-a726-16b2-c1e6a1aa4aa8@metricspace.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 2, 2018 at 7:29 PM, Eric McCorkle <eric@metricspace.net> wrote: > For future reference, this seems to be more or less what I'm after: > > for f in /etc/trust/root/certs/*.pub.pem; do echo -n "static const char > `basename ${f%%.*}`_data[] = {"; openssl x509 -outform DER -in > /etc/trust/root/certs/local.pub.pem | hexdump -v -e '1/1 "0x%02x,"'; > echo "};"; done Another option instead of the hexdump format is just "xxd -i" (xxd is part of vim), although that works best if the intermediary output is written to a file (it populates the struct name automatically). Something like: for f in .../*pub.pem; do openssl x509 -outform DER -in ... > "$(basename "...")_data" && xxd -i "$(basename "...")_data" ; done Its output is nicely formatted with spaces and line wrapping. Best, Conrad
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpVGvT=Hp91B_hnTiAxkO85OfbtQSODGXz3VMg%2BJOHrexQ>