Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

JSON Web Encryption implementation in Python

Project Description

[JSON Web Encryption]( implementation in Python

[![PyPI version](](
[![Build Status](](

## Basic Usage

import jwe

key = b'MySecretKey'
salt = b'pepper'

derived_key = jwe.kdf(key, salt)

encoded = jwe.encrypt(b'SuperSecretData', derived_key)


jwe.decrypt(encoded, derived_key) # b'SuperSecretData'

## FAQ

### What is the kdf function? Should I use it? Do I have to use it?

`jwe.kdf` is a very simple [key derivation function]( that uses the [PBKDF2](

It is mostly there for the purpose of [key stretching]( so that users' keys do not have to be the perfect length for AES256.

You do not have to use it, but if you do not your key must be exactly 256 bits.

### Why is `dir` the only algorithm supported?

Because [key wrapping]( is more or less [completely useless](

### Why is AES 256 GCM the only encryption methd?

It met my needs and I've yet to need another method.
Feel free to submit an issue if you would like another method implemented.

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(8.1 kB) Copy SHA256 Hash SHA256
Source None Dec 16, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers