summaryrefslogtreecommitdiffstats
path: root/src/lib/tlslite/utils/PyCrypto_RSAKey.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/PyCrypto_RSAKey.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/PyCrypto_RSAKey.py')
-rwxr-xr-xsrc/lib/tlslite/utils/PyCrypto_RSAKey.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/lib/tlslite/utils/PyCrypto_RSAKey.py b/src/lib/tlslite/utils/PyCrypto_RSAKey.py
deleted file mode 100755
index 48b5cef03..000000000
--- a/src/lib/tlslite/utils/PyCrypto_RSAKey.py
+++ /dev/null
@@ -1,61 +0,0 @@
-"""PyCrypto RSA implementation."""
-
-from cryptomath import *
-
-from RSAKey import *
-from Python_RSAKey import Python_RSAKey
-
-if pycryptoLoaded:
-
- from Crypto.PublicKey import RSA
-
- class PyCrypto_RSAKey(RSAKey):
- def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0):
- if not d:
- self.rsa = RSA.construct( (n, e) )
- else:
- self.rsa = RSA.construct( (n, e, d, p, q) )
-
- def __getattr__(self, name):
- return getattr(self.rsa, name)
-
- def hasPrivateKey(self):
- return self.rsa.has_private()
-
- def hash(self):
- return Python_RSAKey(self.n, self.e).hash()
-
- def _rawPrivateKeyOp(self, m):
- s = numberToString(m)
- byteLength = numBytes(self.n)
- if len(s)== byteLength:
- pass
- elif len(s) == byteLength-1:
- s = '\0' + s
- else:
- raise AssertionError()
- c = stringToNumber(self.rsa.decrypt((s,)))
- return c
-
- def _rawPublicKeyOp(self, c):
- s = numberToString(c)
- byteLength = numBytes(self.n)
- if len(s)== byteLength:
- pass
- elif len(s) == byteLength-1:
- s = '\0' + s
- else:
- raise AssertionError()
- m = stringToNumber(self.rsa.encrypt(s, None)[0])
- return m
-
- def writeXMLPublicKey(self, indent=''):
- return Python_RSAKey(self.n, self.e).write(indent)
-
- def generate(bits):
- key = PyCrypto_RSAKey()
- def f(numBytes):
- return bytesToString(getRandomBytes(numBytes))
- key.rsa = RSA.generate(bits, f)
- return key
- generate = staticmethod(generate)