Creating a signature
Signing requires a private key whose type matches the selected scheme. For RSA-PSS, the salt length is part of the signing parameters; the key also carries its RSA hash settings. For ECDSA, the EC key's named curve and the selected digest must be compatible. The browser signs the encoded message bytes and returns signature bytes.