Example #1
0
 def sync(self, context):
     """ refresh the crypto state """
     self.key = AES_KEY().fromPyObj(context.evpCtx.cipher_data)  #
     # print self.key
     # copy counter content
     self.iv = model.bytes2array(context.evpCtx.iv, ctypes.c_ubyte)
     log.info("IV value is %s" % (myhex(context.evpCtx.iv)))
Example #2
0
 def sync(self, context):
   ''' refresh the crypto state '''
   self.block_size = context.block_size
   self.key = AES_KEY().fromPyObj(context.evpCtx.cipher_data) # 
   #print self.key
   # copy counter content
   self.iv = model.bytes2array(context.evpCtx.iv, ctypes.c_ubyte)
   log.info('IV value is %s'%(myhex(context.evpCtx.iv)) )
Example #3
0
 def fromPyObj(self,pyobj):
   #recurse copy aes_ctx
   self.r_ctx = rijndael_ctx().fromPyObj(pyobj.r_ctx)
   #copy counter
   self.r_iv = bytes2array(pyobj.r_iv, ctypes.c_ubyte)
   return self
Example #4
0
 def fromPyObj(self,pyobj):
   self.decrypt = pyobj.decrypt
   self.Nr = pyobj.Nr
   self.ek = bytes2array(pyobj.ek, ctypes.c_uint32)
   self.dk = bytes2array(pyobj.dk, ctypes.c_uint32)
   return self
Example #5
0
 def fromPyObj(self,pyobj):
   #recurse copy aes_ctx
   self.aes_ctx = AES_KEY().fromPyObj(pyobj.aes_ctx)
   #copy counter
   self.aes_counter=bytes2array(pyobj.aes_counter, ctypes.c_ubyte)
   return self
Example #6
0
def CAST_KEY_fromPyObj(self,pyobj):
  #copy P and S
  self.data = bytes2array(pyobj.data, ctypes.c_uint)
  self.short_key = pyobj.short_key
  return self
Example #7
0
def RC4_KEY_fromPyObj(self,pyobj):
  #copy P and S
  self.data = bytes2array(pyobj.data, ctypes.c_uint)
  self.x = pyobj.x
  self.y = pyobj.y
  return self
Example #8
0
def AES_KEY_fromPyObj(self,pyobj):
  #copy rd_key
  self.rd_key=bytes2array(pyobj.rd_key,ctypes.c_ulong)
  #copy rounds
  self.rounds=pyobj.rounds
  return self
Example #9
0
def BF_KEY_fromPyObj(self,pyobj):
  #copy P and S
  self.P = bytes2array(pyobj.P, ctypes.c_ulong)
  self.S = bytes2array(pyobj.S, ctypes.c_ulong)
  return self