예제 #1
0
def _CKD_pub(cK, c, s):
    I = hmac_oneshot(c, cK + s, hashlib.sha512)
    pubkey = ecc.ECPrivkey(I[0:32]) + ecc.ECPubkey(cK)
    if pubkey.is_at_infinity():
        raise ecc.InvalidECPointException()
    cK_n = pubkey.get_public_key_bytes(compressed=True)
    c_n = I[32:]
    return cK_n, c_n
예제 #2
0
def is_old_mpk(mpk: str) -> bool:
    try:
        int(mpk, 16)
    except:
        return False
    if len(mpk) != 128:
        return False
    try:
        ecc.ECPubkey(bfh('04' + mpk))
    except:
        return False
    return True
예제 #3
0
파일: keystore.py 프로젝트: martyp11/PyB
 def get_pubkey_from_mpk(self, mpk, for_change, n):
     z = self.get_sequence(mpk, for_change, n)
     master_public_key = ecc.ECPubkey(bfh('04' + mpk))
     public_key = master_public_key + z * ecc.generator()
     return public_key.get_public_key_hex(compressed=False)
예제 #4
0
파일: bitcoin.py 프로젝트: martyp11/PyB
def _CKD_pub(cK, c, s):
    I = hmac.new(c, cK + s, hashlib.sha512).digest()
    pubkey = ecc.ECPrivkey(I[0:32]) + ecc.ECPubkey(cK)
    cK_n = pubkey.get_public_key_bytes(compressed=True)
    c_n = I[32:]
    return cK_n, c_n