Index: third_party/tlslite/tlslite/utils/pycrypto_tripledes.py |
diff --git a/third_party/tlslite/tlslite/utils/pycrypto_tripledes.py b/third_party/tlslite/tlslite/utils/pycrypto_tripledes.py |
index 0bc1104ab993f6bc1f2e525fdcb0e604a90b408f..8117f34b85e168c5330a335887889c367da28cbc 100644 |
--- a/third_party/tlslite/tlslite/utils/pycrypto_tripledes.py |
+++ b/third_party/tlslite/tlslite/utils/pycrypto_tripledes.py |
@@ -1,7 +1,10 @@ |
+# Author: Trevor Perrin |
+# See the LICENSE file for legal information regarding use of this file. |
+ |
"""PyCrypto 3DES implementation.""" |
-from cryptomath import * |
-from tripledes import * |
+from .cryptomath import * |
+from .tripledes import * |
if pycryptoLoaded: |
import Crypto.Cipher.DES3 |
@@ -13,10 +16,14 @@ if pycryptoLoaded: |
def __init__(self, key, mode, IV): |
TripleDES.__init__(self, key, mode, IV, "pycrypto") |
+ key = bytes(key) |
+ IV = bytes(IV) |
self.context = Crypto.Cipher.DES3.new(key, mode, IV) |
def encrypt(self, plaintext): |
- return self.context.encrypt(plaintext) |
+ plaintext = bytes(plaintext) |
+ return bytearray(self.context.encrypt(plaintext)) |
def decrypt(self, ciphertext): |
- return self.context.decrypt(ciphertext) |
+ ciphertext = bytes(ciphertext) |
+ return bytearray(self.context.decrypt(ciphertext)) |