Skip to main content

A JOSE implementation in Python

Build Status Coverage Status

The JavaScript Object Signing and Encryption (JOSE) technologies - JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), and JSON Web Algorithms (JWA) - collectively can be used to encrypt and/or sign content using a variety of algorithms. While the full set of permutations is extremely large, and might be daunting to some, it is expected that most applications will only use a small set of algorithms to meet their needs.

Principles

This is a JOSE implementation that is meant to be simple to use, both on and off of AppEngine.

Examples

JSON Web Signature

JSON Web Signatures (JWS) are used to digitally sign a JSON encoded object and represent it as a compact URL-safe string.

Signing tokens

>>> from jose import jws
>>> signed = jws.sign({'a': 'b'}, 'secret', algorithm='HS256')
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiYiJ9.jiMyrsmD8AoHWeQgmxZ5yq8z0lXS67_QGs52AzC8Ru8'

Verifying token signatures

>>> jws.verify(signed, 'secret', algorithms=['HS256'])
{'a': 'b'}

JSON Web Token

JSON Web Tokens (JWT) are a JWS with a set of reserved claims to be used in a standardized manner.

JWT Reserved Claims

Claim

Name

Format

Usage

‘exp’

Expiration

int

The time after which the token is invalid.

‘nbf’

Not Before

int

The time before which the token is invalid.

‘iss’

Issuer

str

The principal that issued the JWT.

‘aud’

Audience

str or list(str)

The recipient that the JWT is intended for.

‘iat’

Issued At

int

The time at which the JWT was issued.

Algorithms

The following algorithms are currently supported.

Algorithm Value

Digital Signature or MAC Algorithm

HS256

HMAC using SHA-256 hash algorithm

HS384

HMAC using SHA-384 hash algorithm

HS512

HMAC using SHA-512 hash algorithm

RS256

RSASSA using SHA-256 hash algorithm

RS384

RSASSA using SHA-384 hash algorithm

RS512

RSASSA using SHA-512 hash algorithm

Thanks

This library is based heavily on the work of the guys over at PyJWT.

Metadata

Release files for python-jose 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-jose 0.2.0
File Size Uploaded
python-jose-0.2.0.tar.gz 8.9 kB Details

Release files / python-jose-0.2.0.tar.gz

Download URL python-jose-0.2.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e0f63694fcce22f534ab9b9d329e278ab2752dc710ab4c1608fd6195a69eaf33
BLAKE2b-256 checksum
How to use checksums
7543f1551f1cd0b78b26fd390105da353ac5fee0f5c1fcfa3b0f682686498e51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.5.0

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.7.0

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.0

1 release file

This release

0.2.0 This release

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page