<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/cryptography.git/src/cryptography/fernet.py, branch 3.4.3</title>
<subtitle>github.com: pyca/cryptography.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/'/>
<entry>
<title>Apply type annotations to x509 ct and ocsp (#5712)</title>
<updated>2021-01-30T22:44:14+00:00</updated>
<author>
<name>Alex Gaynor</name>
<email>alex.gaynor@gmail.com</email>
</author>
<published>2021-01-30T22:44:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=f16bff2cbd2855f0becb27724334e4bdb0679247'/>
<id>f16bff2cbd2855f0becb27724334e4bdb0679247</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Apply type annotations to fernet (#5708)</title>
<updated>2021-01-29T21:39:20+00:00</updated>
<author>
<name>Alex Gaynor</name>
<email>alex.gaynor@gmail.com</email>
</author>
<published>2021-01-29T21:39:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=db9e20a4cefdf8802d89740d54188d9c53975fe4'/>
<id>db9e20a4cefdf8802d89740d54188d9c53975fe4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Complete removal of py2 (#5533)</title>
<updated>2020-12-09T15:13:48+00:00</updated>
<author>
<name>Alex Gaynor</name>
<email>alex.gaynor@gmail.com</email>
</author>
<published>2020-12-09T15:13:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=e66db8079d3fbd0110e87ece1fd48f4bfd9e48b9'/>
<id>e66db8079d3fbd0110e87ece1fd48f4bfd9e48b9</id>
<content type='text'>
* Drop Python 2

* Black everything</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Drop Python 2

* Black everything</pre>
</div>
</content>
</entry>
<entry>
<title>Remove __future__ import from our code (#5610)</title>
<updated>2020-12-09T06:35:11+00:00</updated>
<author>
<name>Alex Gaynor</name>
<email>alex.gaynor@gmail.com</email>
</author>
<published>2020-12-09T06:35:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=e0477596f7117845aa2d8768bf1b75162b3d915b'/>
<id>e0477596f7117845aa2d8768bf1b75162b3d915b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>use _get_backend everywhere (#5408)</title>
<updated>2020-08-16T22:04:10+00:00</updated>
<author>
<name>Paul Kehrer</name>
<email>paul.l.kehrer@gmail.com</email>
</author>
<published>2020-08-16T22:04:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=0ed8d6624608c1a23f5a2909b3db45c56915f20e'/>
<id>0ed8d6624608c1a23f5a2909b3db45c56915f20e</id>
<content type='text'>
* use _get_backend everywhere

* black</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* use _get_backend everywhere

* black</pre>
</div>
</content>
</entry>
<entry>
<title>Paint it Black by the Rolling Stones (#5324)</title>
<updated>2020-07-20T18:06:29+00:00</updated>
<author>
<name>Alex Gaynor</name>
<email>alex.gaynor@gmail.com</email>
</author>
<published>2020-07-20T18:06:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=60aa04481fb187334a783c2d9facc3fe814af5d1'/>
<id>60aa04481fb187334a783c2d9facc3fe814af5d1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Disallow ttl=None in (Multi)Fernet.decrypt_at_time() (#5280)</title>
<updated>2020-06-25T01:51:54+00:00</updated>
<author>
<name>Jakub Stasiak</name>
<email>jakub@stasiak.at</email>
</author>
<published>2020-06-25T01:51:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=97193752945cd62eef4371f7c8c04e7806d9e37b'/>
<id>97193752945cd62eef4371f7c8c04e7806d9e37b</id>
<content type='text'>
* Disallow ttl=None in (Multi)Fernet.decrypt_at_time()

Since the introduction of the _at_time() methods in #5256[1] there's
been this little voice in the back of my mind telling me that maybe it's
not the best idea to allow ttl=None in decrypt_at_time(). It's been like
this for convenience and code reuse reasons.

Then I submitted a patch for cryptography stubs in typeshed[2] and I had
to decide whether to define decrypt_at_time()'s ttl as int and be
incompatible with cryptography's behavior or Optional[int] and advertise
an API that can be misused much too easily. I went ahead with int.

Considering the above I decided to propose this patch. Some amount of
redundancy (and a new test to properly cover the
MultiFernet.decrypt_at_time() implementation) is a price to prevent
clients from shooting themselves in the foot with the tll=None gun since
setting ttl to None disabled timestamp checks even if current_time was
provided.

[1] https://github.com/pyca/cryptography/pull/5256
[2] https://github.com/python/typeshed/pull/4238

* Actually test the return value here

* Fix formatting</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Disallow ttl=None in (Multi)Fernet.decrypt_at_time()

Since the introduction of the _at_time() methods in #5256[1] there's
been this little voice in the back of my mind telling me that maybe it's
not the best idea to allow ttl=None in decrypt_at_time(). It's been like
this for convenience and code reuse reasons.

Then I submitted a patch for cryptography stubs in typeshed[2] and I had
to decide whether to define decrypt_at_time()'s ttl as int and be
incompatible with cryptography's behavior or Optional[int] and advertise
an API that can be misused much too easily. I went ahead with int.

Considering the above I decided to propose this patch. Some amount of
redundancy (and a new test to properly cover the
MultiFernet.decrypt_at_time() implementation) is a price to prevent
clients from shooting themselves in the foot with the tll=None gun since
setting ttl to None disabled timestamp checks even if current_time was
provided.

[1] https://github.com/pyca/cryptography/pull/5256
[2] https://github.com/python/typeshed/pull/4238

* Actually test the return value here

* Fix formatting</pre>
</div>
</content>
</entry>
<entry>
<title>Add a way to pass current time to Fernet (#5256)</title>
<updated>2020-06-14T18:30:18+00:00</updated>
<author>
<name>Jakub Stasiak</name>
<email>jakub@stasiak.at</email>
</author>
<published>2020-06-14T18:30:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=0d0d70bd78f432397b91eee4d9743000686037a6'/>
<id>0d0d70bd78f432397b91eee4d9743000686037a6</id>
<content type='text'>
* Add a way to pass current time to Fernet

The motivation behind this is to be able to unit test code using Fernet
easily without having to monkey patch global state.

* Reformat to satisfy flake8

* Trigger a Fernet.encrypt() branch missing from coverage

* Revert specifying explicit current time in MultiFernet.rotate()

Message's timestamp is not verified anyway since ttl is None.

* Change the Fernet's explicit current time API slightly

This's been suggested in code review.

* Fix a typo

* Fix a typo

* Restore full MultiFernet test coverage and fix a typo

* Restore more coverage

time.time() is not called by MultiFernet.rotate() anymore so the monkey
patching and lambda need to go, because the patched function is not used
and coverage calculation will rightfully notice it.

* Remove an unused import

* Document when the *_at_time Fernet methods were added</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Add a way to pass current time to Fernet

The motivation behind this is to be able to unit test code using Fernet
easily without having to monkey patch global state.

* Reformat to satisfy flake8

* Trigger a Fernet.encrypt() branch missing from coverage

* Revert specifying explicit current time in MultiFernet.rotate()

Message's timestamp is not verified anyway since ttl is None.

* Change the Fernet's explicit current time API slightly

This's been suggested in code review.

* Fix a typo

* Fix a typo

* Restore full MultiFernet test coverage and fix a typo

* Restore more coverage

time.time() is not called by MultiFernet.rotate() anymore so the monkey
patching and lambda need to go, because the patched function is not used
and coverage calculation will rightfully notice it.

* Remove an unused import

* Document when the *_at_time Fernet methods were added</pre>
</div>
</content>
</entry>
<entry>
<title>centralize our bytes check (#4622)</title>
<updated>2018-12-02T11:20:33+00:00</updated>
<author>
<name>Paul Kehrer</name>
<email>paul.l.kehrer@gmail.com</email>
</author>
<published>2018-12-02T11:20:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=afaa4c65b58e31f36a8162f88ad79829f68d0a86'/>
<id>afaa4c65b58e31f36a8162f88ad79829f68d0a86</id>
<content type='text'>
this will make life a bit easier when we support bytearrays</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this will make life a bit easier when we support bytearrays</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for extracting timestamp from a Fernet token (#4229)</title>
<updated>2018-05-12T15:57:32+00:00</updated>
<author>
<name>Paul Kehrer</name>
<email>paul.l.kehrer@gmail.com</email>
</author>
<published>2018-05-12T15:57:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cryptography.git/commit/?id=36ad98fd5e4b7358dc2aa903b6d51569bf19c5f8'/>
<id>36ad98fd5e4b7358dc2aa903b6d51569bf19c5f8</id>
<content type='text'>
* Add API for retrieving the seconds-to-expiry for the token, given a TTL.

* Process PR feedback:

* Do compute the TTL, but just the age of the token. The caller
can decided what to do next.

* Factored out the HMAC signature verification to a separate function.

* Fixed a copy&amp;paste mistake in the test cases

* Tests cleanup.

* `struct` no longer needed

* Document `def age()`

* typo in `age()` documentation

* token, not data

* remove test for TTL expiry that is already covered by the parameterized `test_invalid()`.

* let's call this extract_timestamp and just return timestamp

* review comments

* it's UNIX I know this
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Add API for retrieving the seconds-to-expiry for the token, given a TTL.

* Process PR feedback:

* Do compute the TTL, but just the age of the token. The caller
can decided what to do next.

* Factored out the HMAC signature verification to a separate function.

* Fixed a copy&amp;paste mistake in the test cases

* Tests cleanup.

* `struct` no longer needed

* Document `def age()`

* typo in `age()` documentation

* token, not data

* remove test for TTL expiry that is already covered by the parameterized `test_invalid()`.

* let's call this extract_timestamp and just return timestamp

* review comments

* it's UNIX I know this
</pre>
</div>
</content>
</entry>
</feed>
