Skip to content

Commit

Permalink
Now using different keys for AES and HMACSHA256
Browse files Browse the repository at this point in the history
  • Loading branch information
st3fan committed Nov 1, 2010
1 parent 1c6e6e1 commit e128a9d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Desktop/desktop.py
Expand Up @@ -150,12 +150,15 @@ def main():
sys.exit(1)

# Put Client.Message3

aes_key = sha256("encrypt:" + key)
hmac_key = sha256("hmac:" + key)

iv = '0123456780abcdef'
cleartext = simplejson.dumps({ 'username': 'st3fan', 'password': 'test', 'secret': 'OHAI-ITIS-CAPS-LOCK-DAYY' })
ciphertext = encrypt(cleartext, key, iv)
ciphertext = encrypt(cleartext, aes_key, iv)
ciphertext_base64 = base64.b64encode(ciphertext)
hmac_hex = binascii.hexlify(hmac(key, ciphertext_base64, algo="sha256"))
hmac_hex = binascii.hexlify(hmac(hmac_key, ciphertext_base64, algo="sha256"))
payload = {'ciphertext': ciphertext_base64,
'IV': base64.b64encode(iv),
'hmac': hmac_hex}
Expand Down

0 comments on commit e128a9d

Please sign in to comment.