Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 89439ff

Browse files
committed
Merge branch 'release/1.2.0'
2 parents 5042219 + 8cad94b commit 89439ff

20 files changed

+356
-1277
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ doc/__build/*
1111
*_rsa.pub
1212
locale/
1313
pip-log.txt
14+
/.idea
15+
/.eggs

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
httpsig Changes
22
---------------
33

4+
1.2.0 (2018-Mar-28)
5+
-------------------
6+
7+
* Switched to pycryptodome instead of PyCrypto
8+
* Updated tests with the test data from Draft 8 and verified it still passes.
9+
* Dropped official Python 3.2 support (pip dropped it so it can't be properly tested)
10+
* Cleaned up the code to be more PEP8-like.
11+
412
1.1.2 (2015-Feb-11)
513
-------------------
614

MANIFEST

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ README.rst
55
requirements.txt
66
setup.cfg
77
setup.py
8-
versioneer.py
98
httpsig/__init__.py
10-
httpsig/_version.py
119
httpsig/requests_auth.py
1210
httpsig/sign.py
1311
httpsig/utils.py

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
include *.rst
22
include *.txt
3-
include versioneer.py
4-
include httpsig/_version.py
53
include httpsig/tests/*.pem

README.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,35 @@ httpsig
77
.. image:: https://travis-ci.org/ahknight/httpsig.svg?branch=develop
88
:target: https://travis-ci.org/ahknight/httpsig
99

10-
Sign HTTP requests with secure signatures according to the IETF HTTP Signatures specification (`Draft 3`_). This is a fork of the original module_ to fully support both RSA and HMAC schemes as well as unit test both schemes to prove they work. It's being used in production and is actively-developed.
10+
Sign HTTP requests with secure signatures according to the IETF HTTP Signatures specification (`Draft 8`_). This is a fork of the original module_ to fully support both RSA and HMAC schemes as well as unit test both schemes to prove they work. It's being used in production and is actively-developed.
1111

1212
See the original project_, original Python module_, original spec_, and `current IETF draft`_ for more details on the signing scheme.
1313

1414
.. _project: https://github.com/joyent/node-http-signature
1515
.. _module: https://github.com/zzsnzmn/py-http-signature
1616
.. _spec: https://github.com/joyent/node-http-signature/blob/master/http_signing.md
1717
.. _`current IETF draft`: https://datatracker.ietf.org/doc/draft-cavage-http-signatures/
18-
.. _`Draft 3`: http://tools.ietf.org/html/draft-cavage-http-signatures-03
18+
.. _`Draft 8`: http://tools.ietf.org/html/draft-cavage-http-signatures-08
1919

2020
Requirements
2121
------------
2222

23-
* Python 2.7, 3.2, 3.3, 3.4
24-
* pycryptodome_
23+
* Python 2.7, 3.3-3.6
24+
* PyCryptodome_
2525

2626
Optional:
2727

2828
* requests_
2929

30-
.. _pycryptodome: https://pypi.python.org/pypi/pycryptodome
30+
.. _PyCryptodome: https://pypi.python.org/pypi/pycryptodome
3131
.. _requests: https://pypi.python.org/pypi/requests
3232

33+
For testing:
34+
35+
* tox
36+
* pyenv (optional, handy way to access multiple versions)
37+
$ for VERS in 2.7.14 3.3.7 3.4.8 3.5.5 3.6.4; do pyenv install -s $VERS; done
38+
3339
Usage
3440
-----
3541

@@ -105,6 +111,15 @@ or::
105111

106112
tox
107113

114+
Known Limitations
115+
-----------------
116+
117+
1. Multiple values for the same header are not supported. New headers with the same name will overwrite the previous header. It might be possible to replace the CaseInsensitiveDict with the collection that the email package uses for headers to overcome this limitation.
118+
2. Keyfiles with passwords are not supported. There has been zero vocal demand for this so if you would like it, a PR would be a good way to get it in.
119+
3. Draft 2 added support for the Signature header. As this was principally designed to be an authentication helper, that header is not currently supported. PRs welcome. (It is trivial to move the value after generation, of course.)
120+
4. Draft 2 added support for ecdsa-sha256. This is available in PyCryptodome but has not been added to httpsig. PRs welcome.
121+
122+
108123
License
109124
-------
110125

httpsig/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
from pkg_resources import get_distribution, DistributionNotFound
2+
13
from .sign import Signer, HeaderSigner
24
from .verify import Verifier, HeaderVerifier
35

4-
from ._version import get_versions
5-
__version__ = get_versions()['version']
6-
del get_versions
6+
try:
7+
__version__ = get_distribution(__name__).version
8+
except DistributionNotFound:
9+
# package is not installed
10+
pass
11+
12+
__all__ = (Signer, HeaderSigner, Verifier, HeaderVerifier)

httpsig/_version.py

Lines changed: 0 additions & 188 deletions
This file was deleted.

httpsig/requests_auth.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from requests.auth import AuthBase
1+
import requests.auth
22
try:
33
# Python 3
44
from urllib.parse import urlparse
@@ -9,20 +9,23 @@
99
from .sign import HeaderSigner
1010

1111

12-
class HTTPSignatureAuth(AuthBase):
13-
'''
12+
class HTTPSignatureAuth(requests.auth.AuthBase):
13+
"""
1414
Sign a request using the http-signature scheme.
1515
https://github.com/joyent/node-http-signature/blob/master/http_signing.md
1616
17-
key_id is the mandatory label indicating to the server which secret to use
18-
secret is the filename of a pem file in the case of rsa, a password string in the case of an hmac algorithm
19-
algorithm is one of the six specified algorithms
20-
headers is a list of http headers to be included in the signing string, defaulting to "Date" alone.
21-
'''
17+
`key_id` is the mandatory label indicating to the server which secret to
18+
use secret is the filename of a pem file in the case of rsa, a password
19+
string in the case of an hmac algorithm
20+
`algorithm` is one of the six specified algorithms
21+
headers is a list of http headers to be included in the signing string,
22+
defaulting to "Date" alone.
23+
"""
2224
def __init__(self, key_id='', secret='', algorithm=None, headers=None):
2325
headers = headers or []
24-
self.header_signer = HeaderSigner(key_id=key_id, secret=secret,
25-
algorithm=algorithm, headers=headers)
26+
self.header_signer = HeaderSigner(
27+
key_id=key_id, secret=secret,
28+
algorithm=algorithm, headers=headers)
2629
self.uses_host = 'host' in [h.lower() for h in headers]
2730

2831
def __call__(self, r):

0 commit comments

Comments
 (0)