Skip to content

Commit

Permalink
triple DES implementation added
Browse files Browse the repository at this point in the history
necessary update pass fix

Necessary update pass fix tlsfuzzer#2

Necessary update pass fix tlsfuzzer#3

Necessary update pass fix
  • Loading branch information
avargaRH authored and root committed Jan 31, 2018
1 parent dfba95e commit c808849
Show file tree
Hide file tree
Showing 3 changed files with 562 additions and 645 deletions.
9 changes: 6 additions & 3 deletions tlslite/utils/cipherfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from tlslite.utils import python_aesgcm
from tlslite.utils import python_chacha20_poly1305
from tlslite.utils import python_rc4
from tlslite.utils import python_tripledes

from tlslite.utils import cryptomath

tripleDESPresent = False
tripleDESPresent = True

if cryptomath.m2cryptoLoaded:
from tlslite.utils import openssl_aes
Expand Down Expand Up @@ -118,7 +119,7 @@ def createRC4(key, IV, implList=None):
raise NotImplementedError()

#Create a new TripleDES instance
def createTripleDES(key, IV, implList=None):
def createTripleDES(key, IV=None, implList=None):
"""Create a new 3DES object.
:type key: str
Expand All @@ -131,11 +132,13 @@ def createTripleDES(key, IV, implList=None):
:returns: A 3DES object.
"""
if implList is None:
implList = ["openssl", "pycrypto"]
implList = ["openssl", "pycrypto", "python"]

for impl in implList:
if impl == "openssl" and cryptomath.m2cryptoLoaded:
return openssl_tripledes.new(key, 2, IV)
elif impl == "pycrypto" and cryptomath.pycryptoLoaded:
return pycrypto_tripledes.new(key, 2, IV)
elif impl == "python":
return python_tripledes.new(key, IV)
raise NotImplementedError()

0 comments on commit c808849

Please sign in to comment.