Skip to content
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

Transactionalize #9

Merged
merged 7 commits into from
Sep 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
*.pyc

26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,47 @@ Usage Example

```python
import srp

# The salt and verifier returned from srp.create_salted_verification_key() should be
# stored on the server.
salt, vkey = srp.create_salted_verification_key( 'testuser', 'testpassword' )

class AuthenticationFailed (Exception):
pass

# ~~~ Begin Authentication ~~~

usr = srp.User( 'testuser', 'testpassword' )
uname, A = usr.start_authentication()

# The authentication process can fail at each step from this
# point on. To comply with the SRP protocol, the authentication
# process should be aborted on the first failure.

# Client => Server: username, A
svr = srp.Verifier( uname, salt, vkey, A )
s,B = svr.get_challenge()

if s is None or B is None:
raise AuthenticationFailed()

# Server => Client: s, B
M = usr.process_challenge( s, B )

if M is None:
raise AuthenticationFailed()

# Client => Server: M
HAMK = svr.verify_session( M )

if HAMK is None:
raise AuthenticationFailed()

# Server => Client: HAMK
usr.verify_session( HAMK )

# At this point the authentication process is complete.

assert usr.authenticated()
assert svr.authenticated()
```
Expand Down Expand Up @@ -117,9 +117,9 @@ Documentation:
$ cd srp/doc
$ sphinx-build -b html . <desired output directory>
```

Validity & Performance Testing:
```
$ python setup.py build
$ python test_srp.py
```
$ python srp/test_srp.py
```
79 changes: 35 additions & 44 deletions srp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@

_mod = None

try:
import srp._srp
_mod = srp._srp
except ImportError:
pass

if not _mod:
try:
import srp._ctsrp
_mod = srp._ctsrp
except ImportError:
pass

if not _mod:
import srp._pysrp
_mod = srp._pysrp

User = _mod.User
Verifier = _mod.Verifier
create_salted_verification_key = _mod.create_salted_verification_key

SHA1 = _mod.SHA1
SHA224 = _mod.SHA224
SHA256 = _mod.SHA256
SHA384 = _mod.SHA384
SHA512 = _mod.SHA512

NG_1024 = _mod.NG_1024
NG_2048 = _mod.NG_2048
NG_4096 = _mod.NG_4096
NG_8192 = _mod.NG_8192
NG_CUSTOM = _mod.NG_CUSTOM










_mod = None

try:
import srp._srp
_mod = srp._srp
except ImportError:
pass

if not _mod:
try:
import srp._ctsrp
_mod = srp._ctsrp
except ImportError:
pass

if not _mod:
import srp._pysrp
_mod = srp._pysrp

User = _mod.User
Verifier = _mod.Verifier
create_salted_verification_key = _mod.create_salted_verification_key

SHA1 = _mod.SHA1
SHA224 = _mod.SHA224
SHA256 = _mod.SHA256
SHA384 = _mod.SHA384
SHA512 = _mod.SHA512

NG_1024 = _mod.NG_1024
NG_2048 = _mod.NG_2048
NG_4096 = _mod.NG_4096
NG_8192 = _mod.NG_8192
NG_CUSTOM = _mod.NG_CUSTOM
Loading