Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: third_party/tlslite/tlslite/utils/pycrypto_tripledes.py

Issue 210323002: Update tlslite to 0.4.6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Executable bit and --similarity=80 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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))
« no previous file with comments | « third_party/tlslite/tlslite/utils/pycrypto_rsakey.py ('k') | third_party/tlslite/tlslite/utils/python_aes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698