Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: lfaraone/mtnas
base: 66e1b45425
...
head fork: lfaraone/mtnas
compare: 075f46a35f
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 27, 2012
@lfaraone client: Typecast status for concatination
This fixes a bug where device.py would crash at the end of its operation
due to a concatination of a string and an int.
110cbe8
Commits on Feb 28, 2012
@lfaraone Ignore compiled python files. d0c524c
@lfaraone Use urlsafe encoding for binary data.
This allows for compatability with the b64 encoders / decoders used by Keyczar
075f46a
View
1  .gitignore
@@ -1,3 +1,4 @@
device.ini
settings.py
*.db
+*.pyc
View
2  mtnac/device.py
@@ -61,7 +61,7 @@
inp = raw_input("Do you want to approve this? [y/N/?] ").lower()
if inp == 'y':
print "approval result: " + server.approve(tid_from_server, device_id, message_from_server)
- print "status: " + server.check_status(tid_from_server)
+ print "status: " + str(server.check_status(tid_from_server))
done = True
elif inp == 'n':
while not done:
View
4 mtnac/lib.py
@@ -60,7 +60,7 @@ def _modify_sign_crypt_request(self, transaction_id, device_id, message, action)
return crypted_request, signed_request
def _send_modification(self, payload, signature):
- req = urllib2.Request((self.base_url + "/api/txn/+mod"), urllib.urlencode({"payload": base64.b64encode(payload), "signature": base64.b64encode(signature), 'device_id' : str(DEVICE_ID)}))
+ req = urllib2.Request((self.base_url + "/api/txn/+mod"), urllib.urlencode({"payload": base64.urlsafe_b64encode(payload), "signature": base64.urlsafe_b64encode(signature), 'device_id' : str(DEVICE_ID)}))
response = urllib2.urlopen(req)
return response.read()
@@ -84,7 +84,7 @@ def check_status(self, transaction_id):
def retrieve_transaction(self, device_id):
req = urllib2.Request((self.base_url + "/api/user/+last-txn?device_id=" + str(device_id)))
enc_txn_desc_base64, sig_txn_desc_base64 = urllib2.urlopen(req).read().split("|")
- enc_txn_desc, sig_txn_desc = base64.b64decode(enc_txn_desc_base64), base64.b64decode(sig_txn_desc_base64)
+ enc_txn_desc, sig_txn_desc = base64.urlsafe_b64decode(enc_txn_desc_base64), base64.urlsafe_b64decode(sig_txn_desc_base64)
if not self.server_key.Verify(enc_txn_desc, sig_txn_desc):
raise ValueError
transaction = json.loads(self.device_key.Decrypt(enc_txn_desc))[0]
View
4 mtnas/api/veritas.py
@@ -22,7 +22,9 @@ def refers_to(authentication_attempt):
class ModificationRequest(object):
def __init__(self, payload, signature, encoded_user_key, encoded_server_key):
- self.encrypted_action_message, self.action_message_signature = base64.b64decode(payload), base64.b64decode(signature)
+ print "foo"
+ print payload, signature
+ self.encrypted_action_message, self.action_message_signature = base64.urlsafe_b64decode(payload.encode('ascii')), base64.urlsafe_b64decode(signature.encode('ascii'))
# TODO XXX MAGIC : we need to encode and re-decode the messages, binary data on the wire == eww as far as spit is concerned
# TODO: Might want to pass the pub/privkey *objects* rather than encoded versions
self.userpubkey = RsaPublicKey.Read(encoded_user_key)
View
2  mtnas/api/views.py
@@ -98,7 +98,7 @@ def AuthRetriever(request):
txn_desc = serializers.serialize("json", txns[0:1])
enc_txn_desc = RsaPublicKey.Read(device.public_key).Encrypt(txn_desc)
sig_txn_desc = RsaPrivateKey.Read(Server.objects.get(id=1).private_key).Sign(enc_txn_desc)
- return HttpResponse( base64.b64encode(enc_txn_desc) + "|" + base64.b64encode(sig_txn_desc))
+ return HttpResponse( base64.urlsafe_b64encode(enc_txn_desc) + "|" + base64.urlsafe_b64encode(sig_txn_desc))
@require_post
def CreateUser(request):

No commit comments for this range

Something went wrong with that request. Please try again.