Function signHex

  • sign hexadecimal data with specified private key and algorithm

    Parameters

    • sigalg: SignatureAlgorithmName

      signature algorithm name (ex. SHA256withRSA)

    • keyobjOrString: string | CryptoKey

      key for signing. CryptoKey object, PKCS#8 PEM private key or HMAC hexadecimal key string

    • hData: string

      hexadecimal data to be signed

    • Optional saltlen: number

      RSA-PSS salt length when you don't want to use default length

    Returns Promise<string>

    hexadecimal signature value

    See

    Example

    await signHex("SHA256withECDSA", prvkeyObj, "616161") -> "631b3f..."