# Method Web.decode_jws()

Method decode_jws

  ``array` decode_jws(`array`(``Crypto.Sign.State``|`Crypto.MAC.State`)|``Crypto.Sign.State``|`Crypto.MAC.State` `sign`, `string(7bit)` `jws`)`

Description

  Decode a JSON Web Signature (JWS).

Parameter `sign`

  The asymetric public or MAC key(s) to validate the jws against.

Parameter `jws`

  A JWS as eg returned by encode_jws().

Returns

  Returns `0` (zero) on validation failure.

  Returns an array with two elements on success:

  Array
  ``mapping`(`string(7bit)`:`string(7bit)`|`int`) `0`` | The JOSE header.
  ``mixed` `1`` | The JWS payload.

  See RFC 7515 section 3.

See also

  encode_jws(), decode_jwt(), `Crypto.Sign.State()->jose_decode()`, RFC 7515