#NEWLINE# def test_broad( ) : #NEWLINE# #INDENT# G = EcGroup ( ) #NEWLINE# g = G . generator ( ) #NEWLINE# x = G . order ( ) . random ( ) #NEWLINE# ( a , puba ) = pair ( G ) #NEWLINE# ( b , pubb ) = pair ( G ) #NEWLINE# ( c , pubc ) = pair ( G ) #NEWLINE# ( a2 , puba2 ) = pair ( pki2 ) #NEWLINE# ( b2 , pubb2 ) = pair ( G ) #NEWLINE# ( c2 , pubc2 ) = pair ( G ) #NEWLINE# pki = { #NEWLINE# #INDENT# 'a' : ( puba , puba2 ) , #NEWLINE# 'b' : ( pubb , pubb2 ) , #NEWLINE# 'c' : ( pubc , pubc2 ) , #NEWLINE# #UNINDENT# } #NEWLINE# client = KulanClient ( G , 'me' , x , pki ) #NEWLINE# msgs = client . broadcast_encrypt ( b'Hello!' ) #NEWLINE# pki2 = { #NEWLINE# #INDENT# 'me' : ( x * g ) , #NEWLINE# 'b' : ( pubb , pubb2 ) , #NEWLINE# 'c' : ( pubc , pubc2 ) , #NEWLINE# #UNINDENT# } #NEWLINE# dec_client = KulanClient ( G , 'a' , a , pki2 ) #NEWLINE# dec_client . priv_enc = a2 #NEWLINE# dec_client . pub_enc = puba2 #NEWLINE# ( namex , keysx ) = dec_client . broadcast_decrypt ( msgs ) #NEWLINE# assert ( namex == 'me' )