Function b64nltohex

  • convert a Base64 encoded string with new lines to a hexadecimal string

    Parameters

    • s: string

      Base64 encoded string with new lines

    Returns string

    hexadecimal string

    Description

    This function converts from a Base64 encoded string with new lines to a hexadecimal string. This is useful to handle PEM encoded file. This function removes any non-Base64 characters (i.e. not 0-9,A-Z,a-z,,+,=) including new line.

    Example

    hextob64nl(
    "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4\r\n" +
    "OTAxMjM0NTY3ODkwCg==\r\n")
    ->
    "123456789012345678901234567890123456789012345678901234567890"