def sk_from_dict(dict_object): sk = SecretKey() sk.x = dict_object['x'] sk.pk = pk_from_dict(dict_object['pk']) return sk
# from helios/views.py from cryptosystems import c2048 as crypto p, q, g, x, y = crypto() _default_crypto.p = p _default_crypto.q = q _default_crypto.g = g _default_public_key = PublicKey() _default_public_key.p = _default_crypto.p _default_public_key.q = _default_crypto.q _default_public_key.g = _default_crypto.g _default_secret_key = SecretKey() _default_secret_key.x = x _default_secret_key.pk = _default_public_key _default_public_key.y = y def get_timestamp(): return datetime.strftime(datetime.utcnow(), "%Y-%m-%dT%H:%M:%S.%fZ") def get_choice_params(nr_choices, nr_candidates=None, max_choices=None): if nr_candidates is None: nr_candidates = nr_choices if max_choices is None: max_choices = nr_candidates if nr_choices < 0 or nr_candidates <= 0 or max_choices <= 0: