# Method Web.encode_jws()

Method encode_jws

  ``string(7bit)` encode_jws(``Crypto.Sign.State``|`Crypto.MAC.State` `sign`, `mixed` `tbs`, `string(7bit)`|`void` `media_type`)`

Description

  Encode a JSON Web Signature (JWS).

Parameter `sign`

  The asymetric private or MAC key to use for signing the result.

Parameter `tbs`

  The value to sign.

Parameter `media_type`

  The media type of `tbs`, cf RFC 7515 section 4.1.9.

Returns

  Returns `0` (zero) on encoding failure (usually that `sign` doesn't support JWS.

  Returns a corresponding JWS on success.

See also

  decode_jwt(), RFC 7515