Exemplo n.º 1
0
 def test_asym_encryption(self):
     identifier = helpers.pick_random()
     ciphertext = helpers.asym_encrypt(identifier, constants.P.public_key)
     s = helpers.serialize([0, ciphertext])
     [op, d] = helpers.deserialize(s)
     plaintext = helpers.asym_decrypt(d, constants.P.private_key)
     self.assertEqual(identifier, plaintext)
Exemplo n.º 2
0
Arquivo: user.py Projeto: t2d/pyanotel
 def make_call(self, callee, caller, pseudonym, filename):
     plaintext = [callee, caller, pseudonym, filename]
     ciphertext = asym_encrypt(plaintext, constants.P.public_key)
     packet = [constants.Header.INITCALL, ciphertext]
     self.sendLine(serialize(packet))
     self.p_deferred = defer.Deferred()
     self.p_deferred.addCallback(self.connect_to_n, filename)
Exemplo n.º 3
0
Arquivo: user.py Projeto: t2d/pyanotel
 def pseudonym_update(self, pseudonym, identifier, secret):
     """ Update pseudonym at Pseudonym Provider with asymmetric encryption (ECIES) """
     plaintext = [pseudonym, identifier, secret]
     ciphertext = asym_encrypt(plaintext, constants.P.public_key)
     packet = [constants.Header.PSEUDONYMUPDATE, ciphertext]
     self.sendLine(serialize(packet))
Exemplo n.º 4
0
Arquivo: user.py Projeto: t2d/pyanotel
 def send_msg(self, callee, caller, msg):
     msg = make_msg(msg)
     plaintext = [callee, caller, msg]
     ciphertext = asym_encrypt(plaintext, constants.P.public_key)
     packet = [constants.Header.MSG, ciphertext]
     self.sendLine(serialize(packet))
Exemplo n.º 5
0
Arquivo: user.py Projeto: t2d/pyanotel
 def location_update(self, pseudonym, location, seed):
     """ Update location at Location Provider with asymmetric encryption (ECIES) """
     plaintext = [pseudonym, location, seed]
     ciphertext = asym_encrypt(plaintext, constants.L.public_key)
     packet = [constants.Header.LOCATIONUPDATE, ciphertext]
     self.sendLine(serialize(packet))