Add new rotbuf primitives
Rewrite keyring pack/unpack for extensibility

Use new rotbuf primitives to handle rotated buffers