def compare_keys(a, b):
    """
    Compares the base64 encoded DER structure of the keys
    """
    # Filter removes possible empty lines.
    # We then slice away header and footer.
    a_b64 = "".join(list(filter(None, a.splitlines()))[1:-1])
    b_b64 = "".join(list(filter(None, b.splitlines()))[1:-1])
    return a_b64 == b_b64