aes new raise compliant

This commit is contained in:
mdipierro
2012-10-23 09:44:34 -05:00
parent 8c514df120
commit ab066397b2
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-10-22 22:52:36) stable
Version 2.2.1 (2012-10-23 09:44:29) stable
+5 -5
View File
@@ -64,7 +64,7 @@ def new(key, mode=MODE_CBC, IV=None):
return ECBMode(AES(key))
elif mode == MODE_CBC:
if IV is None:
raise ValueError, "CBC mode needs an IV value!"
raise ValueError("CBC mode needs an IV value!")
return CBCMode(AES(key), IV)
else:
@@ -91,7 +91,7 @@ class AES(object):
elif self.key_size == 32:
self.rounds = 14
else:
raise ValueError, "Key length must be 16, 24 or 32 bytes"
raise ValueError("Key length must be 16, 24 or 32 bytes")
self.expand_key()
@@ -313,7 +313,7 @@ class ECBMode(object):
"""Perform ECB mode with the given function"""
if len(data) % self.block_size != 0:
raise ValueError, "Plaintext length must be multiple of 16"
raise ValueError("Plaintext length must be multiple of 16")
block_size = self.block_size
data = array('B', data)
@@ -357,7 +357,7 @@ class CBCMode(object):
block_size = self.block_size
if len(data) % block_size != 0:
raise ValueError, "Plaintext length must be multiple of 16"
raise ValueError("Plaintext length must be multiple of 16")
data = array('B', data)
IV = self.IV
@@ -381,7 +381,7 @@ class CBCMode(object):
block_size = self.block_size
if len(data) % block_size != 0:
raise ValueError, "Ciphertext length must be multiple of 16"
raise ValueError("Ciphertext length must be multiple of 16")
data = array('B', data)
IV = self.IV
+2 -2
View File
@@ -1670,8 +1670,8 @@ class WSGIWorker(Worker):
peercert = conn.socket.getpeercert(binary_form=True)
environ['SSL_CLIENT_RAW_CERT'] = \
peercert and ssl.DER_cert_to_PEM_cert(peercert)
except Exception, e:
print e
except Exception:
print sys.exc_info()[1]
if environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked':
environ['wsgi.input'] = ChunkedReader(sock_file)