[Reviewer: Ellie] Base64 padding fixes

Fixes https://github.com/Metaswitch/homestead/issues/54.