Function hextopem

  • get PEM string from hexadecimal data and header string

    Parameters

    • dataHex: string

      hexadecimal string of PEM body

    • pemHeader: string

      PEM header string (ex. 'RSA PRIVATE KEY')

    • separator: string = "\r\n"

      new line string

    Returns string

    PEM formatted string of input data

    Description

    This function converts a hexadecimal string to a PEM string with a specified header. Its line break will be CRLF("\r\n").

    Example

    hextopem('616161', 'RSA PRIVATE KEY') ->
    -----BEGIN PRIVATE KEY-----
    YWFh
    -----END PRIVATE KEY-----