]> wagner.pp.ru Git - oss/ctypescrypto.git/blobdiff - ctypescrypto/bio.py
Added support for MAC
[oss/ctypescrypto.git] / ctypescrypto / bio.py
index ae89aa3bac354b9e934002b3c40e2c1820fec96f..b1700b9a869ca80dd1eba7dba1c13117782202b0 100644 (file)
@@ -3,7 +3,7 @@ Interface to OpenSSL BIO library
 """
 from ctypescrypto import libcrypto
 from ctypes import c_char_p, c_void_p, c_int, string_at, c_long,POINTER,byref, create_string_buffer
 """
 from ctypescrypto import libcrypto
 from ctypes import c_char_p, c_void_p, c_int, string_at, c_long,POINTER,byref, create_string_buffer
-class Membio:
+class Membio(object):
        """ 
                Provides interface to OpenSSL memory bios 
                use str() or unicode() to get contents of writable bio
        """ 
                Provides interface to OpenSSL memory bios 
                use str() or unicode() to get contents of writable bio
@@ -42,7 +42,7 @@ class Membio:
                @param length - if specifed, limits amount of data read. If not BIO is read until end of buffer
                """
                if not length is None:
                @param length - if specifed, limits amount of data read. If not BIO is read until end of buffer
                """
                if not length is None:
-                       if type(length)!=type(0):
+                       if not isinstance(length,(int,long)):
                                raise TypeError("length to read should be number")
                        buf=create_string_buffer(length)
                        readbytes=libcrypto.BIO_read(self.bio,buf,length)
                                raise TypeError("length to read should be number")
                        buf=create_string_buffer(length)
                        readbytes=libcrypto.BIO_read(self.bio,buf,length)