예제 #1
0
파일: BIO.py 프로젝트: nanki/M2Crypto
 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
예제 #2
0
 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
예제 #3
0
파일: BIO.py 프로젝트: nanki/M2Crypto
 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())
예제 #4
0
 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())