Function pemtohex

  • get hexacedimal string from PEM format data

    Parameters

    • s: string

      PEM formatted string

    • Optional sHead: string

      PEM header string without BEGIN/END

    Returns string

    hexadecimal string data of PEM contents

    Description

    This static method gets a hexacedimal string of contents from PEM format data. You can explicitly specify PEM header by sHead argument. Any space characters such as white space or new line will be omitted.

    Example

    pemtohex("-----BEGIN PUBLIC KEY...") -> "3082..."
    pemtohex("-----BEGIN CERTIFICATE...", "CERTIFICATE") -> "3082..."
    pemtohex(" \r\n-----BEGIN DSA PRIVATE KEY...") -> "3082..."
    pemtohex("-----BEGIN EC PARAMETERS...----BEGIN EC PRIVATE KEY...." -> "3082..."