Function signBuf

  • sign 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

    • bufData: ArrayBuffer | Uint8Array | DataView

      data to be signed

    • Optional saltlen: number

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

    Returns Promise<ArrayBuffer>

    ArrayBuffer signature value

    See

    Example

    await signBuf("SHA256withECDSA", prvkeyObj, hextoArrayBuffer("616161")) -> ArrayBuffer...