2018-02-01 08:47:06 +00:00
|
|
|
from cryptography.hazmat.primitives.asymmetric import ec
|
|
|
|
|
|
|
|
|
|
|
|
class UmbralParameters(object):
|
2018-02-08 04:09:47 +00:00
|
|
|
def __init__(self, curve: ec.EllipticCurve = None):
|
|
|
|
from umbral.point import Point
|
|
|
|
from umbral.utils import unsafe_hash_to_point
|
|
|
|
|
|
|
|
self.curve = curve
|
|
|
|
|
2018-02-01 08:47:06 +00:00
|
|
|
self.g = Point.get_generator_from_curve(self.curve)
|
|
|
|
self.order = Point.get_order_from_curve(self.curve)
|
|
|
|
|
|
|
|
g_bytes = self.g.to_bytes(is_compressed=True)
|
|
|
|
|
|
|
|
domain_seed = b'NuCypherKMS/UmbralParameters/'
|
|
|
|
|
|
|
|
self.h = unsafe_hash_to_point(self.curve, g_bytes, domain_seed + b'h')
|
|
|
|
self.u = unsafe_hash_to_point(self.curve, g_bytes, domain_seed + b'u')
|