/
usr
/
lib64
/
python2.6
/
site-packages
/
M2Crypto
/
/usr/lib64/python2.6/site-packages/M2Crypto
mkdir
upload
Name
Size
Mode
Actions
PGP/
-
0755
rm
SSL/
-
0755
rm
ASN1.py
5614
0644
edit
dl
rm
ASN1.pyc
9462
0644
edit
dl
rm
ASN1.pyo
9063
0644
edit
dl
rm
AuthCookie.py
3085
0644
edit
dl
rm
AuthCookie.pyc
5339
0644
edit
dl
rm
AuthCookie.pyo
5275
0644
edit
dl
rm
BIO.py
7389
0644
edit
dl
rm
BIO.pyc
12186
0644
edit
dl
rm
BIO.pyo
12186
0644
edit
dl
rm
BN.py
1330
0644
edit
dl
rm
BN.pyc
1873
0644
edit
dl
rm
BN.pyo
1873
0644
edit
dl
rm
callback.py
249
0644
edit
dl
rm
callback.pyc
475
0644
edit
dl
rm
callback.pyo
475
0644
edit
dl
rm
DH.py
2374
0644
edit
dl
rm
DH.pyc
4681
0644
edit
dl
rm
DH.pyo
4248
0644
edit
dl
rm
DSA.py
14019
0644
edit
dl
rm
DSA.pyc
17433
0644
edit
dl
rm
DSA.pyo
16845
0644
edit
dl
rm
EC.py
10916
0644
edit
dl
rm
EC.pyc
13287
0644
edit
dl
rm
EC.pyo
12683
0644
edit
dl
rm
Engine.py
3397
0644
edit
dl
rm
Engine.pyc
5492
0644
edit
dl
rm
Engine.pyo
5492
0644
edit
dl
rm
Err.py
1123
0644
edit
dl
rm
Err.pyc
2687
0644
edit
dl
rm
Err.pyo
2687
0644
edit
dl
rm
EVP.py
11810
0644
edit
dl
rm
EVP.pyc
16643
0644
edit
dl
rm
EVP.pyo
16643
0644
edit
dl
rm
ftpslib.py
2881
0644
edit
dl
rm
ftpslib.pyc
3946
0644
edit
dl
rm
ftpslib.pyo
3946
0644
edit
dl
rm
httpslib.py
7861
0644
edit
dl
rm
httpslib.pyc
7797
0644
edit
dl
rm
httpslib.pyo
7699
0644
edit
dl
rm
m2.py
785
0644
edit
dl
rm
m2.pyc
963
0644
edit
dl
rm
m2.pyo
963
0644
edit
dl
rm
m2urllib.py
2124
0644
edit
dl
rm
m2urllib.pyc
2177
0644
edit
dl
rm
m2urllib.pyo
2177
0644
edit
dl
rm
m2urllib2.py
5269
0644
edit
dl
rm
m2urllib2.pyc
5120
0644
edit
dl
rm
m2urllib2.pyo
5065
0644
edit
dl
rm
m2xmlrpclib.py
1928
0644
edit
dl
rm
m2xmlrpclib.pyc
2318
0644
edit
dl
rm
m2xmlrpclib.pyo
2318
0644
edit
dl
rm
Rand.py
488
0644
edit
dl
rm
Rand.pyc
583
0644
edit
dl
rm
Rand.pyo
583
0644
edit
dl
rm
RC4.py
692
0644
edit
dl
rm
RC4.pyc
1634
0644
edit
dl
rm
RC4.pyo
1634
0644
edit
dl
rm
RSA.py
13128
0644
edit
dl
rm
RSA.pyc
17393
0644
edit
dl
rm
RSA.pyo
16991
0644
edit
dl
rm
SMIME.py
7479
0644
edit
dl
rm
SMIME.pyc
10955
0644
edit
dl
rm
SMIME.pyo
10667
0644
edit
dl
rm
threading.py
347
0644
edit
dl
rm
threading.pyc
789
0644
edit
dl
rm
threading.pyo
789
0644
edit
dl
rm
util.py
1588
0644
edit
dl
rm
util.pyc
3081
0644
edit
dl
rm
util.pyo
3081
0644
edit
dl
rm
X509.py
34646
0644
edit
dl
rm
X509.pyc
47271
0644
edit
dl
rm
X509.pyo
44913
0644
edit
dl
rm
__init__.py
1421
0644
edit
dl
rm
__init__.pyc
1980
0644
edit
dl
rm
__init__.pyo
1980
0644
edit
dl
rm
__m2crypto.so
445064
0644
edit
dl
rm
Edit:
/usr/lib64/python2.6/site-packages/M2Crypto/BIO.py
(7389B)
"""M2Crypto wrapper for OpenSSL BIO API. Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved.""" import m2 # Deprecated from m2 import bio_do_handshake as bio_do_ssl_handshake from cStringIO import StringIO class BIOError(Exception): pass m2.bio_init(BIOError) class BIO: """Abstract object interface to the BIO API.""" m2_bio_free = m2.bio_free def __init__(self, bio=None, _pyfree=0, _close_cb=None): self.bio = bio self._pyfree = _pyfree self._close_cb = _close_cb self.closed = 0 self.write_closed = 0 def __del__(self): if self._pyfree: self.m2_bio_free(self.bio) def _ptr(self): return self.bio # Deprecated. bio_ptr = _ptr def fileno(self): return m2.bio_get_fd(self.bio) def readable(self): return not self.closed def read(self, size=None): if not self.readable(): raise IOError, 'cannot read' if size is None: buf = StringIO() while 1: data = m2.bio_read(self.bio, 4096) if not data: break buf.write(data) return buf.getvalue() elif size == 0: return '' elif size < 0: raise ValueError, 'read count is negative' else: return m2.bio_read(self.bio, size) def readline(self, size=4096): if not self.readable(): raise IOError, 'cannot read' buf = m2.bio_gets(self.bio, size) return buf def readlines(self, sizehint='ignored'): if not self.readable(): raise IOError, 'cannot read' lines=[] while 1: buf=m2.bio_gets(self.bio, 4096) if buf is None: break lines.append(buf) return lines def writeable(self): return (not self.closed) and (not self.write_closed) def write(self, data): if not self.writeable(): raise IOError, 'cannot write' return m2.bio_write(self.bio, data) def write_close(self): self.write_closed = 1 def flush(self): m2.bio_flush(self.bio) def reset(self): """ Sets the bio to its initial state """ return m2.bio_reset(self.bio) def close(self): self.closed = 1 if self._close_cb: self._close_cb() def should_retry(self): """ Can the call be attempted again, or was there an error ie do_handshake """ return m2.bio_should_retry(self.bio) def should_read(self): """ Returns whether the cause of the condition is the bio should read more data """ return m2.bio_should_read(self.bio) def should_write(self): """ Returns whether the cause of the condition is the bio should write more data """ return m2.bio_should_write(self.bio) class MemoryBuffer(BIO): """ Object interface to BIO_s_mem. Empirical testing suggests that this class performs less well than cStringIO, because cStringIO is implemented in C, whereas this class is implemented in Python. Thus, the recommended practice is to use cStringIO for regular work and convert said cStringIO object to a MemoryBuffer object only when necessary. """ def __init__(self, data=None): BIO.__init__(self) self.bio = m2.bio_new(m2.bio_s_mem()) self._pyfree = 1 if data is not None: m2.bio_write(self.bio, data) def __len__(self): return m2.bio_ctrl_pending(self.bio) def read(self, size=0): if not self.readable(): raise IOError, 'cannot read' if size: return m2.bio_read(self.bio, size) else: return m2.bio_read(self.bio, m2.bio_ctrl_pending(self.bio)) # Backwards-compatibility. getvalue = read_all = read def write_close(self): self.write_closed = 1 m2.bio_set_mem_eof_return(self.bio, 0) close = write_close class File(BIO): """ Object interface to BIO_s_fp. This class interfaces Python to OpenSSL functions that expect BIO *. For general file manipulation in Python, use Python's builtin file object. """ def __init__(self, pyfile, close_pyfile=1): BIO.__init__(self, _pyfree=1) self.pyfile = pyfile self.close_pyfile = close_pyfile self.bio = m2.bio_new_fp(pyfile, 0) def close(self): self.closed = 1 if self.close_pyfile: self.pyfile.close() def openfile(filename, mode='rb'): return File(open(filename, mode)) class IOBuffer(BIO): """ Object interface to BIO_f_buffer. Its principal function is to be BIO_push()'ed on top of a BIO_f_ssl, so that makefile() of said underlying SSL socket works. """ m2_bio_pop = m2.bio_pop m2_bio_free = m2.bio_free def __init__(self, under_bio, mode='rwb', _pyfree=1): BIO.__init__(self, _pyfree=_pyfree) self.io = m2.bio_new(m2.bio_f_buffer()) self.bio = m2.bio_push(self.io, under_bio._ptr()) # This reference keeps the underlying BIO alive while we're not closed. self._under_bio = under_bio if 'w' in mode: self.write_closed = 0 else: self.write_closed = 1 def __del__(self): if getattr(self, '_pyfree', 0): self.m2_bio_pop(self.bio) self.m2_bio_free(self.io) def close(self): BIO.close(self) class CipherStream(BIO): """ Object interface to BIO_f_cipher. """ SALT_LEN = m2.PKCS5_SALT_LEN m2_bio_pop = m2.bio_pop m2_bio_free = m2.bio_free def __init__(self, obio): BIO.__init__(self, _pyfree=1) self.obio = obio self.bio = m2.bio_new(m2.bio_f_cipher()) self.closed = 0 def __del__(self): if not getattr(self, 'closed', 1): self.close() def close(self): self.m2_bio_pop(self.bio) self.m2_bio_free(self.bio) self.closed = 1 def write_close(self): self.obio.write_close() def set_cipher(self, algo, key, iv, op): cipher = getattr(m2, algo, None) if cipher is None: raise ValueError, ('unknown cipher', algo) m2.bio_set_cipher(self.bio, cipher(), key, iv, op) m2.bio_push(self.bio, self.obio._ptr()) class SSLBio(BIO): """ Object interface to BIO_f_ssl """ def __init__(self, _pyfree=1): BIO.__init__(self, _pyfree) self.bio = m2.bio_new(m2.bio_f_ssl()) self.closed = 0 def set_ssl(self, conn, close_flag=m2.bio_noclose): """ Sets the bio to the SSL pointer which is contained in the connection object. """ self._pyfree = 0 m2.bio_set_ssl(self.bio, conn.ssl, close_flag) if close_flag == m2.bio_noclose: conn.set_ssl_close_flag(m2.bio_close) def do_handshake(self): """ Do the handshake. Return 1 if the handshake completes Return 0 or a negative number if there is a problem """ return m2.bio_do_handshake(self.bio)
Save
cmd:
run