def do_set_hsm_conf(): reg = Election().get_root_reg() if reg.check(['common', 'hsm', 'tokenname']): try: def_tokenname = \ reg.read_string_value(['common', 'hsm'], 'tokenname').value except: def_tokenname = "evote" else: def_tokenname = "evote" token_name = uiutil.ask_string(\ "Sisesta HSM'i partitsiooni nimi", None, None, def_tokenname) if reg.check(['common', 'hsm', 'privkeylabel']): try: def_privkeylabel = \ reg.read_string_value(['common', 'hsm'], 'privkeylabel').value except: def_privkeylabel = "evote_key" else: def_privkeylabel = "evote_key" priv_key_label = uiutil.ask_string(\ "Sisesta privaatvõtme nimi", None, None, def_privkeylabel) if reg.check(['common', 'hsm', 'pkcs11']): try: def_pkcs11 = \ reg.read_string_value(['common', 'hsm'], 'pkcs11').value except: def_pkcs11 = "/usr/lunasa/lib/libCryptoki2_64.so" else: def_pkcs11 = "/usr/lunasa/lib/libCryptoki2_64.so" pkcs11_path = uiutil.ask_file_name(\ "Sisesta PKCS11 teegi asukoht", def_pkcs11) cmd = "%s set %s %s %s" % \ (SCRIPT_CONFIG_HSM, token_name, priv_key_label, pkcs11_path) os.system(cmd)
def do_import_error_strings(): import evmessage evstrings_file = uiutil.ask_file_name("Sisesta teadete-faili asukoht") evm = evmessage.EvMessage() evm.import_str_file(evstrings_file)