agent, broker: use base64 library to encode/decode data

This fixes an issue caused on systems with certain locales, and makes
the code much more straightforward in general.

Change-Id: I46c3593837ff2d0c51de58fca5b9680625424baf
Signed-off-by: Greg Padgett <gpadgett@redhat.com>