-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce version 0x81, including microsecond timestamps #13
Commits on Oct 12, 2015
-
Configuration menu - View commit details
-
Copy full SHA for bf8ca33 - Browse repository at this point
Copy the full SHA bf8ca33View commit details -
Configuration menu - View commit details
-
Copy full SHA for 23422cf - Browse repository at this point
Copy the full SHA 23422cfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a218da - Browse repository at this point
Copy the full SHA 0a218daView commit details -
Introduce microsecond timestamps to the specification
Given that the timestamp is already a 64-bit unsigned big-endian integer, the spec will remain viable for over 500,000 years. This allows us to more precisely compare token creation timestamps against revocation event timestamps (which already have microsecond precision). This helps us avoid a race condition wherein a token can be created *after* a revocation event, but appear to be created *before* it, thus matching the revocation event and being considered invalid. After this change, the specification is still vulnerable to this race condition, but the time window to reproduce it is narrowed to a single microsecond, instead of a single second. Closes fernet#12
Configuration menu - View commit details
-
Copy full SHA for 75b357c - Browse repository at this point
Copy the full SHA 75b357cView commit details
Commits on Oct 14, 2015
-
Configuration menu - View commit details
-
Copy full SHA for 622a36a - Browse repository at this point
Copy the full SHA 622a36aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 29c0a1e - Browse repository at this point
Copy the full SHA 29c0a1eView commit details -
Explain how to revert to old timestamp values
This is mostly intended to further explain the change in version 0x81.
Configuration menu - View commit details
-
Copy full SHA for 80b4ffa - Browse repository at this point
Copy the full SHA 80b4ffaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4d53223 - Browse repository at this point
Copy the full SHA 4d53223View commit details -
This will ensure that Github will render the spec on the repository's homepage (the repo is already called "spec", after all!).
Configuration menu - View commit details
-
Copy full SHA for 4d993a8 - Browse repository at this point
Copy the full SHA 4d993a8View commit details -
I think I wrote this thinking there was only one difference between the two versions, my grammar followed suit, but the statement should be more generic to handle more than just two versions and more than just one difference between the existing two versions.
Configuration menu - View commit details
-
Copy full SHA for cff53e1 - Browse repository at this point
Copy the full SHA cff53e1View commit details -
Add acceptance tests for 0x81 tokens with TODOs
TODOs are serving as placeholders for actual 0x81 tokens, which I've neither created by hand nor written an implementation to produce, yet.
Configuration menu - View commit details
-
Copy full SHA for 5b702c4 - Browse repository at this point
Copy the full SHA 5b702c4View commit details -
Correct microsecond placement in "now" timestamps
I accidentally put them in the TZ, whoops!
Configuration menu - View commit details
-
Copy full SHA for 1f13494 - Browse repository at this point
Copy the full SHA 1f13494View commit details
Commits on Oct 15, 2015
-
Add valid 0x81 tokens to acceptance tests
I rebuilt the valid 0x80 tokens in the acceptance tests manually using the following function to convert them. This explicitly illustrates the differences between 0x80 and 0x81. import base64 import hashlib import hmac import struct def upgrade_to_81(x80_token, secret): """Upgrade an 0x80 token to 0x81 given a new timestamp and secret.""" # Decode the 0x80 version token. x80_bytes = base64.urlsafe_b64decode(x80_token) # Unpack the timestamp so we can manipulate it. seconds = struct.unpack('>Q', x80_bytes[1:9]) # Convert seconds to microseconds, and add some microseconds. microseconds = int(seconds * 1e6) + 123456 x81_bytes = '\x81' # New version identifier. x81_bytes += struct.pack(">Q", microseconds) x81_bytes += x80_bytes[9:-32] x81_bytes += hmac.new( base64.b64decode(secret)[16:], x81_bytes, hashlib.sha256).digest() return base64.urlsafe_b64encode(x81_bytes)
Configuration menu - View commit details
-
Copy full SHA for 2688de4 - Browse repository at this point
Copy the full SHA 2688de4View commit details