[JSON Web Encryption](https://tools.ietf.org/html/rfc7516) implementation in Python
[](https://badge.fury.io/py/PyJWE)
[](https://travis-ci.org/chrisseto/pyjwe)
## Basic Usage
```python
import jwe
key = b'MySecretKey'
salt = b'pepper'
derived_key = jwe.kdf(key, salt)
encoded = jwe.encrypt(b'SuperSecretData', derived_key)
print(encoded)
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](https://en.wikipedia.org/wiki/Key_derivation_function) that uses the [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2).
It is mostly there for the purpose of [key stretching](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/Key_Wrap) is more or less [completely useless](https://security.stackexchange.com/questions/40052/when-do-i-use-nist-aes-key-wrapping).
### 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.
Metadata
Release files for PyJWE 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyJWE-1.0.0.tar.gz | 8.1 kB | Without provenance | Details for PyJWE-1.0.0.tar.gz |
Release files / PyJWE-1.0.0.tar.gz
| Download URL | PyJWE-1.0.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3b3de7be4fcc260e5f1a47ead9c9a9211d8ce98f9e1d88d9a7225198aa9ce47
|
|
BLAKE2b-256 checksum How to use checksums |
59f99d8f24fdcae49fcb18607bdde460fdfc80a55721b86014d0c2fb617ee8b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for PyJWE 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.