def reencrypt(self, data):
try:
self.decoder = DES.new(self.key, DES.MODE_CBC, self.iv) # need to reinit it each time because of CBC
decrypted=self.unpad(self.decoder.decrypt(base64.b64decode(data)))
if debug:
if len(decrypted)==8 and re.match(self.autogen,decrypted) is not None:
self.debugf.write(self.currentdn+" =* "+decrypted+"\n")
elif re.match(self.alphanumchar,decrypted) is not None:
self.debugf.write(self.currentdn+" => "+decrypted+"\n")
else:
self.debugf.write(self.currentdn+" =x "+decrypted+"\n")
encrypted=self.encoder.encrypt(self.pad(decrypted))
newdata=base64.b64encode(encrypted)
return newdata
except:
raise
评论列表
文章目录