Function pemtocurve

  • get curve name from PKCS#8 PEM private/public key string

    Parameters

    • pem: string

      PKCS#8 PEM private or public key string

    Returns string | null

    supported EC curve name (P-256/384/521) otherwise returns null

    Example

    pemtocurve("-----BEGIN PRIVATE...") -> "P-521"
    pemtocurve("-----BEGIN PUBLIC...") -> null // if RSA key or not supported curve