Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Parse Fernet tokens as much as possible without using a key.

Project description

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.


>>> 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
>>> 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
>>> t.ciphertext
>>> t.hmac


No external testing dependencies are required:

$ python -m unittest discover

Project details

Release history Release notifications

This version
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
keyless_fernet-1.0.0.tar.gz (7.2 kB) Copy SHA256 hash SHA256 Source None Feb 25, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page