[Enrollment v2] Move base64 encoding for pref values to util functions

We currently store strings in preferences, and these string are required
to be valid UTF-8 strings; this is a requirement of base::Value. So,
strings are base64-encoded before being persisted to prefs. This is
particularly necessary for byte strings such as serialized protos.

We create a file of utility functions to perform this encoding and
decoding in order to ensure uniformity.

We choose to use Base64Url encoding to conform with CryptAuth v1
Enrollment and DeviceSync client implementations. Note that previously,
Base64 (not Base64Url) was used in v2 Enrollment; however, there is no
risk of conflicting encodings being stored in the prefs because v2
Enrollment has not been rolled out yet. These changes will be included
in M76 which is the version that v2 Enrollment will be rolled out on.

Bug: 899080, 964563
Change-Id: Ifa6eb5ed9128ea788021146e48eaadd65198691e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1618005
Commit-Queue: Josh Nohle <nohle@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661889}
14 files changed