Function b64topem

  • get PEM string from Base64 string

    Parameters

    • b64: string

      Base64 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 Base64 string to a PEM string with a specified header. Its line break will be CRLF("\r\n").

    Example

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