Beispiel #1
0
	def inner(srv, run_id, accum):
		addresses = []
		slaves = getHosts(accum)
		slave_keyorder = []
		port = port_start
		for key in slaves:
			if key in tags:
				host = slaves[key]
				port += 1
				slave_keyorder.append(key)
				addresses.append([host,port])
		
		
		pallier = ViffPaillier(1024)
		configs = generate_configs(n=len(tags), 
								   t=1, addresses=addresses, 
								   skip_prss=False, 
								   paillier=pallier)
		
		if not os.path.exists(ctx.local_output_dir): #TODO: hack
			os.makedirs(ctx.local_output_dir)
		for i, config in enumerate(configs.values()):
			with open(ljoin(ctx.local_output_dir, slave_keyorder[i]) +'.ini', 'w') as f:
				config.write(outfile=f)
Beispiel #2
0
                  type="int",
                  help="threshold (it must hold that t < n/2)")
parser.add_option("--skip-prss",
                  action="store_true",
                  help="do not generate PRSS keys")

parser.set_defaults(verbose=True,
                    n=3,
                    t=1,
                    prefix='player',
                    skip_prss=False,
                    keysize=1024,
                    paillier='viff')

(options, args) = parser.parse_args()

if "nacl" == options.paillier:
    paillier = NaClPaillier(options.keysize)
else:
    paillier = ViffPaillier(options.keysize)

if len(args) != options.n:
    parser.error("must supply a hostname:port argument for each player")

addresses = [arg.split(':', 1) for arg in args]
configs = generate_configs(options.n, options.t, paillier, addresses,
                           options.prefix, options.skip_prss)

for config in configs.itervalues():
    config.write()
Beispiel #3
0
 def generate_configs(self, *args):
     return generate_configs(paillier=NaClPaillier(self.paillier_key_size),
                             *args)
Beispiel #4
0
parser.add_option("-n", "--players", dest="n", type="int",
                  help="number of players")
parser.add_option("-k", "--keysize", type="int",
                  help="Specify the key-size for Paillier encryption")
parser.add_option("--paillier", type="choice", choices=paillier_choices,
                  help="the implementation of Paillier encryption")
parser.add_option("-t", "--threshold", dest="t", type="int",
                  help="threshold (it must hold that t < n/2)")
parser.add_option("--skip-prss", action="store_true",
                  help="do not generate PRSS keys")

parser.set_defaults(verbose=True, n=3, t=1, prefix='player', skip_prss=False,
                    keysize=1024, paillier='viff')

(options, args) = parser.parse_args()

if "nacl" == options.paillier:
    paillier = NaClPaillier(options.keysize)
else:
    paillier = ViffPaillier(options.keysize)

if len(args) != options.n:
    parser.error("must supply a hostname:port argument for each player")

addresses = [arg.split(':', 1) for arg in args]
configs = generate_configs(options.n, options.t, paillier, addresses,
                           options.prefix, options.skip_prss)

for config in configs.itervalues():
    config.write()
Beispiel #5
0
 def generate_configs(self, *args):
     return generate_configs(
         paillier=NaClPaillier(self.paillier_key_size), *args)
Beispiel #6
0
 def generate_configs(self, *args):
     return generate_configs(*args)