|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/lib64/python2.4/site-packages/M2Crypto/SSL/ |
Upload File : |
"""Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
from M2Crypto import m2
class Cipher:
def __init__(self, cipher):
self.cipher=cipher
def __len__(self):
return m2.ssl_cipher_get_bits(self.cipher)
def __repr__(self):
return "%s-%s" % (self.name(), len(self))
def __str__(self):
return "%s-%s" % (self.name(), len(self))
def version(self):
return m2.ssl_cipher_get_version(self.cipher)
def name(self):
return m2.ssl_cipher_get_name(self.cipher)
class Cipher_Stack:
def __init__(self, stack):
self.stack=stack
def __len__(self):
return m2.sk_ssl_cipher_num(self.stack)
def __getitem__(self, idx):
if not 0 <= idx < m2.sk_ssl_cipher_num(self.stack):
raise IndexError('index out of range')
v=m2.sk_ssl_cipher_value(self.stack, idx)
return Cipher(v)
def __iter__(self):
for i in xrange(m2.sk_ssl_cipher_num(self.stack)):
yield self[i]