def SignGen(message, E, sA): order = E.order for i in range(1, 10): k = ecrand.rnd(order) s, r = do_sign(message, sA, k, E) if (s and r): return s, r
def sign(self, msg, pv_key): """ Signs a message hash. Args: hash_msg (bytes) : the message hash to sign pv_key (ecpy.keys.ECPrivateKey): key to use for signing """ order = pv_key.curve.order for i in range(1,self.maxtries): k = ecrand.rnd(order) sig = self._do_sign(msg, pv_key,k) if sig: return sig return None
def generate_random_scalar(): order = CURVE.order return ecrand.rnd(order)
def generate_key(self, curve): # curve : curve 이름 cv = Curve.get_curve(curve) pv_key = ECPrivateKey(rnd(cv.order), cv) pu_key = pv_key.get_public_key() return (pu_key, pv_key, cv, ECDSA())