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

Commit de3c186

Browse files
committed
Merge branch 'release/1.0.1'
2 parents e13dfb0 + 04550e6 commit de3c186

File tree

17 files changed

+297
-231
lines changed

17 files changed

+297
-231
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
http_signature/_version.py export-subst
2+
httpsig/_version.py export-subst

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
- "3.2"
5+
- "3.3"
6+
- "3.4"
7+
install:
8+
- pip install .
9+
- pip install nose
10+
script: nosetests

CHANGES.rst

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

4-
1.0b2 (2014-Jul-01)
4+
1.0.1 (2014-Jul-02)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
* Python 3 support (2.7 + 3.2-3.4)
8+
* Updated tox and Travis CI configs to test the supported Python versions.
9+
* Updated README.
10+
11+
1.0.0 (2014-Jul-01)
512
~~~~~~~~~~~~~~~~~~~
613
* Written against http://tools.ietf.org/html/draft-cavage-http-signatures-02
714
* Added "setup.py test" and tox support.

MANIFEST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ httpsig/sign.py
1111
httpsig/utils.py
1212
httpsig/verify.py
1313
httpsig/tests/__init__.py
14+
httpsig/tests/rsa_private.pem
15+
httpsig/tests/rsa_public.pem
1416
httpsig/tests/test_signature.py
1517
httpsig/tests/test_utils.py
1618
httpsig/tests/test_verify.py

MANIFEST.in

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

README.rst

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
httpsig
22
=======
33

4-
Sign HTTP requests with secure signatures. See the original project_, original Python module_, original spec_, and IETF draft_ for details.
4+
.. image:: https://travis-ci.org/ahknight/httpsig.svg?branch=master
5+
:target: https://travis-ci.org/ahknight/httpsig
6+
7+
.. image:: https://travis-ci.org/ahknight/httpsig.svg?branch=develop
8+
:target: https://travis-ci.org/ahknight/httpsig
9+
10+
Sign HTTP requests with secure signatures according to the current IETF HTTP Signatures draft_ specification. 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.
11+
12+
See the original project_, original Python module_, original spec_, and current IETF draft_ for more details on the signing scheme.
513

614
.. _project: https://github.com/joyent/node-http-signature
715
.. _module: https://github.com/zzsnzmn/py-http-signature
@@ -11,6 +19,7 @@ Sign HTTP requests with secure signatures. See the original project_, original P
1119
Requirements
1220
------------
1321

22+
* Python 2.7, 3.2, 3.3, 3.4
1423
* PyCrypto_
1524

1625
Optional:
@@ -23,22 +32,40 @@ Optional:
2332
Usage
2433
-----
2534

26-
for simple raw signing::
35+
Real documentation is forthcoming, but for now this should get you started.
36+
37+
For simple raw signing:
38+
39+
.. code:: python
2740
2841
import httpsig
2942
30-
secret = open('rsa_private.pem', 'r').read()
43+
secret = open('rsa_private.pem', 'rb').read()
3144
3245
sig_maker = httpsig.Signer(secret=secret, algorithm='rsa-sha256')
3346
sig_maker.sign('hello world!')
3447
35-
for use with requests::
48+
For general use with web frameworks:
49+
50+
.. code:: python
51+
52+
import httpsig
53+
54+
key_id = "Some Key ID"
55+
secret = b'some big secret'
56+
57+
hs = httpsig.HeaderSigner(key_id, secret, algorithm="hmac-sha256", headers=['(request-line)', 'host', 'date'])
58+
signed_headers_dict = hs.sign({"Date": "Tue, 01 Jan 2014 01:01:01 GMT", "Host": "example.com"}, method="GET", path="/api/1/object/1")
59+
60+
For use with requests:
61+
62+
.. code:: python
3663
3764
import json
3865
import requests
3966
from httpsig.requests_auth import HTTPSignatureAuth
4067
41-
secret = open('rsa_private.pem', 'r').read()
68+
secret = open('rsa_private.pem', 'rb').read()
4269
4370
auth = HTTPSignatureAuth(key_id='Test', secret=secret)
4471
z = requests.get('https://api.example.com/path/to/endpoint',
@@ -47,15 +74,18 @@ for use with requests::
4774
Class initialization parameters
4875
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4976

50-
::
77+
Note that keys and secrets should be bytes objects. At attempt will be made to convert them, but if that fails then exceptions will be thrown.
78+
79+
.. code:: python
5180
5281
httpsig.Signer(secret, algorithm='rsa-sha256')
5382
5483
``secret``, in the case of an RSA signature, is a string containing private RSA pem. In the case of HMAC, it is a secret password.
5584
``algorithm`` is one of the six allowed signatures: ``rsa-sha1``, ``rsa-sha256``, ``rsa-sha512``, ``hmac-sha1``, ``hmac-sha256``,
5685
``hmac-sha512``.
5786

58-
::
87+
88+
.. code:: python
5989
6090
httpsig.requests_auth.HTTPSignatureAuth(key_id, secret, algorithm='rsa-sha256', headers=None)
6191
@@ -70,7 +100,11 @@ To run tests::
70100

71101
python setup.py test
72102

103+
or::
104+
105+
tox
106+
73107
License
74108
-------
75109

76-
MIT
110+
Both this module and the original module_ are licensed under the MIT license.

0 commit comments

Comments
 (0)