summaryrefslogtreecommitdiffstats
path: root/src/lib/tlslite/utils/cipherfactory.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-05-06 01:26:53 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-05-06 01:26:53 +0000
commit9590d0bb421cb7fdf7dd04d4b1d0d77e3f06f13b (patch)
tree768763aa48be1a5a2c8dae7cba81859510f1146e /src/lib/tlslite/utils/cipherfactory.py
parent13f6d1554dd24d08d44662906fa9f3f008a23058 (diff)
downloadbcfg2-9590d0bb421cb7fdf7dd04d4b1d0d77e3f06f13b.tar.gz
bcfg2-9590d0bb421cb7fdf7dd04d4b1d0d77e3f06f13b.tar.bz2
bcfg2-9590d0bb421cb7fdf7dd04d4b1d0d77e3f06f13b.zip
more to python 2.6 ssl
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5187 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/tlslite/utils/cipherfactory.py')
-rwxr-xr-xsrc/lib/tlslite/utils/cipherfactory.py111
1 files changed, 0 insertions, 111 deletions
diff --git a/src/lib/tlslite/utils/cipherfactory.py b/src/lib/tlslite/utils/cipherfactory.py
deleted file mode 100755
index ccbb6b5ff..000000000
--- a/src/lib/tlslite/utils/cipherfactory.py
+++ /dev/null
@@ -1,111 +0,0 @@
-"""Factory functions for symmetric cryptography."""
-
-import os
-
-import Python_AES
-import Python_RC4
-
-import cryptomath
-
-tripleDESPresent = False
-
-if cryptomath.m2cryptoLoaded:
- import OpenSSL_AES
- import OpenSSL_RC4
- import OpenSSL_TripleDES
- tripleDESPresent = True
-
-if cryptomath.cryptlibpyLoaded:
- import Cryptlib_AES
- import Cryptlib_RC4
- import Cryptlib_TripleDES
- tripleDESPresent = True
-
-if cryptomath.pycryptoLoaded:
- import PyCrypto_AES
- import PyCrypto_RC4
- import PyCrypto_TripleDES
- tripleDESPresent = True
-
-# **************************************************************************
-# Factory Functions for AES
-# **************************************************************************
-
-def createAES(key, IV, implList=None):
- """Create a new AES object.
-
- @type key: str
- @param key: A 16, 24, or 32 byte string.
-
- @type IV: str
- @param IV: A 16 byte string
-
- @rtype: L{tlslite.utils.AES}
- @return: An AES object.
- """
- if implList == None:
- implList = ["cryptlib", "openssl", "pycrypto", "python"]
-
- for impl in implList:
- if impl == "cryptlib" and cryptomath.cryptlibpyLoaded:
- return Cryptlib_AES.new(key, 2, IV)
- elif impl == "openssl" and cryptomath.m2cryptoLoaded:
- return OpenSSL_AES.new(key, 2, IV)
- elif impl == "pycrypto" and cryptomath.pycryptoLoaded:
- return PyCrypto_AES.new(key, 2, IV)
- elif impl == "python":
- return Python_AES.new(key, 2, IV)
- raise NotImplementedError()
-
-def createRC4(key, IV, implList=None):
- """Create a new RC4 object.
-
- @type key: str
- @param key: A 16 to 32 byte string.
-
- @type IV: object
- @param IV: Ignored, whatever it is.
-
- @rtype: L{tlslite.utils.RC4}
- @return: An RC4 object.
- """
- if implList == None:
- implList = ["cryptlib", "openssl", "pycrypto", "python"]
-
- if len(IV) != 0:
- raise AssertionError()
- for impl in implList:
- if impl == "cryptlib" and cryptomath.cryptlibpyLoaded:
- return Cryptlib_RC4.new(key)
- elif impl == "openssl" and cryptomath.m2cryptoLoaded:
- return OpenSSL_RC4.new(key)
- elif impl == "pycrypto" and cryptomath.pycryptoLoaded:
- return PyCrypto_RC4.new(key)
- elif impl == "python":
- return Python_RC4.new(key)
- raise NotImplementedError()
-
-#Create a new TripleDES instance
-def createTripleDES(key, IV, implList=None):
- """Create a new 3DES object.
-
- @type key: str
- @param key: A 24 byte string.
-
- @type IV: str
- @param IV: An 8 byte string
-
- @rtype: L{tlslite.utils.TripleDES}
- @return: A 3DES object.
- """
- if implList == None:
- implList = ["cryptlib", "openssl", "pycrypto"]
-
- for impl in implList:
- if impl == "cryptlib" and cryptomath.cryptlibpyLoaded:
- return Cryptlib_TripleDES.new(key, 2, IV)
- elif 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)
- raise NotImplementedError() \ No newline at end of file