keyless-fernet
A Python library to parse Fernet tokens as much as possible without using a key. This is useful for doing limited, non-cryptographic validation or introspection of Fernet tokens.
Usage
>>> token = 'gAAAAAAdwJ6wAAECAwQFBgcICQoLDA0ODy021cpGVWKZ_eEwCGM4BLLF_5CV9dOPmrhuVUPgJobwOz7JcbmrR64jVmpU4IwqDA=='
>>> import keyless_fernet
>>> t = keyless_fernet.Token(token) # tokens are validated on init
>>> t.validate(ttl=60) # but you can also validate a token against any TTL
>>> t.version # retrieve the token's version, as an integer
128
>>> t.timestamp # retrieve the token's timestamp, as a datetime
datetime.datetime(1985, 10, 26, 8, 20)
>>> t.iv # and see the hex representations of the other attributes
'000102030405060708090a0b0c0d0e0f'
>>> t.ciphertext
'2d36d5ca46556299fde13008633804b2'
>>> t.hmac
'c5ff9095f5d38f9ab86e5543e02686f03b3ec971b9ab47ae23566a54e08c2a0c'
Testing
No external testing dependencies are required:
$ python -m unittest discover
Metadata
Release files for keyless_fernet 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 | |
|---|---|---|---|---|
| keyless_fernet-1.0.0.tar.gz | 7.2 kB | Without provenance | Details |
Release files / keyless_fernet-1.0.0.tar.gz
| Download URL | keyless_fernet-1.0.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18bb3033bbf14d891fd36c84045df16994097456dfe41e365a5448dfc581c3e0
|
|
BLAKE2b-256 checksum How to use checksums |
6013dfe56344c8a96cadad33ac482b5585e4656edf2f51926fe06ef95f9739f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for keyless_fernet 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.