LDIF binary data

TL;DR

Binary data in a LDIF file: add a : and base64 the data.

I took a look at a few files in LDIF format lately and some attributes were specified with a double colon, like this:

foo:: blaHblaH

I initially thought it was a typo (I was looking at examples) but I later realized that it was not, because it was all around.

So yes, I admit at having had a totally pragmatic approach to LDIF so far: copy and change based on common sense.

It turns out that a double colon indicates that the data is encoded with base64:

attrval-spec             = AttributeDescription value-spec SEP

value-spec               = ":" (    FILL 0*1(SAFE-STRING) /
                                ":" FILL (BASE64-STRING) /
                                "<" FILL url)

...

BASE64-CHAR              = %x2B / %x2F / %x30-39 / %x3D / %x41-5A /
                           %x61-7A
                           ; +, /, 0-9, =, A-Z, and a-z
                           ; as specified in RFC 2045

BASE64-STRING            = [*(BASE64-CHAR)]

Now I have that matrixesque feeling like I know… how to fit binary data in LDIF!.

Stay safe folks!


Comments? Octodon, , GitHub, Reddit, or drop me a line!