# Method __builtin.Nettle.Sign()->jose_sign()

Method jose_sign

  ``string(7bit)` jose_sign(`string(8bit)` `message`, `mapping`(`string(7bit)`:`string(7bit)`|`int`)|`void` `headers`, `.Hash`|`void` `h`)`

Description

  Signs the `message` with a JOSE JWS signature using hash algorithm `h` and JOSE headers `headers`.

Parameter `message`

  Message to sign.

Parameter `headers`

  JOSE headers to use. Typically a mapping with a single element `"typ"`.

Parameter `h`

  Hash algorithm to use. Valid hashes depend on the signature algorithm. The default value depends on the signature algorithm.

Returns

  Returns the signature on success, and `0` (zero) on failure (typically that either the hash algorithm is invalid for this signature algorithm),

Note

  The default implementation returns `0` for all parameters, and can thus serve as a fallback for signature algorithms that don't support or aren't supported by JWS (eg Crypto.DSA).

See also

  jose_decode(), pkcs_sign(), RFC 7515