Module jose

Expand description

§JOSE: JSON Object Signing and Encryption

JOSE is an IETF standard for securely transferring data between parties using JSON. It provides a general framework for signing and encrypting any kind of data, and it’s the foundation for technologies like JSON Web Tokens (JWTs).

The JOSE framework is made up of several key components:

  • JWS (JSON Web Signature): This specification defines how to create a digital signature for any data. A JWS proves data integrity and authenticity. It consists of a Header, a Payload (the data), and a Signature, all encoded in Base64Url and joined by dots. See rfc7515 for more details.

  • JWE (JSON Web Encryption): This defines a standard way to encrypt data. A JWE ensures the confidentiality of the information, making sure only authorized parties can read it. See rfc7516 for more details.

  • JWK (JSON Web Key): This specifies a JSON format for representing cryptographic keys. This makes it simple to share the public keys required to verify signatures or encrypt data. See rfc7517 for more details.

  • JWA (JSON Web Algorithm): This is essentially a list of the specific cryptographic algorithms that are used for signing and encryption within the JOSE framework. The alg parameter in the JOSE header identifies which algorithm was used. See rfc7518 for more details.

Structs§

DecodedJWS
Decode version of a JWS
DecodedJWSFlattened
Decoded version of a JWSFlattened
DecodedSignature
Decode version of a [Signature]
EcdsaKey
EcdsaKey which is used to identify and authenticate our requests
Empty
When used with serde this will serialize to an empty JSON object ({})
Headers
Headers store protected or unprotected headers and already serializes them to correct JSON values.
JWK
JWK or JSON Web Key as defined in rfc7517
JWS
JWS is the general serialization format as defined in rfc7515, section 7.2.1
JWSBuilder
JWSBuilder should be used when manually creating a JWS, JWSCompact or JWSFlattened
JWSCompact
JWSCompact is a compact JWS representation as defined in rfc7515, section 7.1
JWSFlattened
JWSFlattened is a JWS which is optimized for a single signature, as defined in rfc7515, section 7.2.2
ToVerifySignature
A Signature which still needs to be checked

Enums§

JWA
JWA or JSON Web Algorithms as defined in rfc7518
JWKEllipticCurves
JWKType
The “kty” (key type) parameter identifies the cryptographic algorithm family used with the key, such as “RSA”, “EC”, or “OCT”
JWKUse
JWKUse identifies the intended use of the public key

Constants§

EMPTY_PAYLOAD
Serializes to a JSON empty object {}
NO_PAYLOAD
Serializes to a JSON null value

Traits§

Signer
Signer implements all methods which are needed to sign our JWS requests, and add the needed info to our JOSE headers (JOSE headers = protected + unprotected headers)
Verifier
Verifier will be called to confirm if the received data is valid