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

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.

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
Release History

Release History

This version
History Node

1.0.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
keyless_fernet-1.0.0.tar.gz (7.2 kB) Copy SHA256 Checksum SHA256 Source Feb 25, 2015

Supported By

WebFaction WebFaction Technical Writing 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 Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting