# Method Crypto.RSA.State()->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 RSASSA-PKCS-v1.5 signature using hash algorithm `h`.

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. Currently defaults to SHA256.

Returns

  Returns the signature on success, and `0` (zero) on failure (typically that the hash + salt combo is too large for the RSA modulo).

See also

  pkcs_verify(), `salt_size()`, RFC 7515