Added KLV encoder

Added a BER length encoder; added a encodeKLV to encode key and value buffer pairs into KLVs.