Exemplo n.º 1
0
Arquivo: test_pbp.py Projeto: stef/pbp
 def test_simple_dh(self):
     (exp,pub1) = pbp.dh1_handler()
     (pub2,secret) = pbp.dh2_handler(pub1)
     self.assertEquals(pbp.dh3_handler(pub2,exp), secret)
Exemplo n.º 2
0
 def test_simple_dh(self):
     (exp, pub1) = pbp.dh1_handler()
     (pub2, secret) = pbp.dh2_handler(pub1)
     self.assertEquals(pbp.dh3_handler(pub2, exp), secret)
Exemplo n.º 3
0
         params = pitchfork.start_ecdh(opts.recipient[0])
     else:
         params = dh1_handler()
     if params:
         print "[pbp] secret exponent", b85encode(params[0])
         print "[pbp] public component", b85encode(params[1])
         clearmem(params[0])
 # receive ECDH
 elif opts.action=='d2':
     ensure_dhparam_specified(opts)
     if PITCHFORK and opts.PITCHFORK:
         ensure_recipient_specified(opts)
         pitchfork.init()
         params = pitchfork.resp_ecdh(opts.dh_param, opts.recipient[0])
     else:
         params = dh2_handler(binascii.unhexlify(opts.dh_param))
     if params:
         print "[pbp] shared secret", b85encode(params[1])
         print "[pbp] public component", b85encode(params[0])
         clearmem(params[0])
         clearmem(params[1])
 # finish ECDH
 elif opts.action=='d3':
     ensure_dhparam_specified(opts)
     ensure_dhexp_specified(opts)
     if PITCHFORK and opts.PITCHFORK:
         pitchfork.init()
         sec = pitchfork.end_ecdh(opts.dh_param, opts.dh_exp)
     else:
         sec = dh3_handler(binascii.unhexlify(opts.dh_param), binascii.unhexlify(opts.dh_exp))
     if sec:
Exemplo n.º 4
0
Arquivo: main.py Projeto: TLINDEN/pbp
         params = pitchfork.start_ecdh(opts.recipient[0])
     else:
         params = dh1_handler()
     if params:
         print "secret exponent", b85encode(params[0])
         print "public component", b85encode(params[1])
         clearmem(params[0])
 # receive ECDH
 elif opts.action=='d2':
     ensure_dhparam_specified(opts)
     if PITCHFORK:
         ensure_recipient_specified(opts)
         pitchfork.init()
         params = pitchfork.resp_ecdh(opts.dh_param, opts.recipient[0])
     else:
         params = dh2_handler(binascii.unhexlify(opts.dh_param))
     if params:
         print "shared secret", b85encode(params[1])
         print "public component", b85encode(params[0])
         clearmem(params[0])
         clearmem(params[1])
 # finish ECDH
 elif opts.action=='d3':
     ensure_dhparam_specified(opts)
     ensure_dhexp_specified(opts)
     if PITCHFORK:
         pitchfork.init()
         sec = pitchfork.end_ecdh(opts.dh_param, opts.dh_exp)
     else:
         sec = dh3_handler(binascii.unhexlify(opts.dh_param), binascii.unhexlify(opts.dh_exp))
     if sec: