import base64


def to_base64(byte_array):
    """
    Encodes the given byte array as a base-64 String.

    :param byte_array: The byte array to be encoded.
    :return: The byte array encoded using base-64.
    """
    result = None
    if byte_array is not None:
        result = base64.b64encode(byte_array).decode("utf-8")
    return result