xref: /freebsd/contrib/libder/README.md (revision 35c0a8c449fd2b7f75029ebed5e10852240f0865)
1*35c0a8c4SKyle Evans# libder
2*35c0a8c4SKyle Evans
3*35c0a8c4SKyle Evans## What is libder?
4*35c0a8c4SKyle Evans
5*35c0a8c4SKyle Evanslibder is a small library for encoding/decoding DER-encoded objects.  It is
6*35c0a8c4SKyle Evansexpected to be able to decode any BER-encoded buffer, and an attempt to
7*35c0a8c4SKyle Evansre-encode the resulting tree would apply any normalization expected by a DER
8*35c0a8c4SKyle Evansdecoder.  The author's use is primarily to decode/encode ECC keys for
9*35c0a8c4SKyle Evansinteroperability with OpenSSL.
10*35c0a8c4SKyle Evans
11*35c0a8c4SKyle EvansThe authoritative source for this software is located at
12*35c0a8c4SKyle Evanshttps://git.kevans.dev/kevans/libder, but it's additionally mirrored to
13*35c0a8c4SKyle Evans[GitHub](https://github.com/kevans91/libder) for user-facing interactions.
14*35c0a8c4SKyle EvansPull requests and issues are open on GitHub.
15*35c0a8c4SKyle Evans
16*35c0a8c4SKyle Evans## What is libder not?
17*35c0a8c4SKyle Evans
18*35c0a8c4SKyle Evanslibder is not intended to be a general-purpose library for working with DER/BER
19*35c0a8c4SKyle Evansspecified objects.  It may provide some helpers for building more primitive
20*35c0a8c4SKyle Evansdata types, but libder will quickly punt on anything even remotely complex and
21*35c0a8c4SKyle Evansrequire the library consumer to supply it as a type/payload/size triple that it
22*35c0a8c4SKyle Evanswill treat as relatively opaque (modulo some encoding normalization rules that
23*35c0a8c4SKyle Evanscan be applied without deeply understanding the data contained within).
24*35c0a8c4SKyle Evans
25*35c0a8c4SKyle Evanslibder also doesn't do strict validation of what it reads in today, for better
26*35c0a8c4SKyle Evansor worse.  e.g., a boolean may occupy more than one byte and libder will happily
27*35c0a8c4SKyle Evanspresent it to the application in that way.  It would be normalized on
28*35c0a8c4SKyle Evansre-encoding to 0xff or 0x00 depending on whether any bits are set or not.
29