Genericized keybuffer to cbuffer