Python ecdsa.VerifyingKey.from_public_point() Examples

The following are 4 code examples of ecdsa.VerifyingKey.from_public_point(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module ecdsa.VerifyingKey , or try the search function .
Example #1
Source File: hd_public_key.py    From ontology-python-sdk with GNU Lesser General Public License v3.0 6 votes vote down vote up
def from_parent(parent_key, i):
        if i & HARDENED_INDEX:
            raise ValueError("Can't generate a hardened child key from a parent public key.")

        child = hmac.new(parent_key.chain_code,
                         parent_key.compressed_key + i.to_bytes(length=4, byteorder='big'),
                         hashlib.sha512).digest()
        child_left, child_right = child[:32], child[32:]
        if int.from_bytes(child_left, 'big') >= ecdsa.generator_256.order():
            return None

        temp_pri_key = SigningKey.from_string(string=child_left, curve=curves.NIST256p)

        ki = temp_pri_key.verifying_key.pubkey.point + parent_key.key.pubkey.point
        if ki == ellipticcurve.INFINITY:
            return None

        return HDPublicKey(public_key=VerifyingKey.from_public_point(point=ki, curve=curves.NIST256p),
                           chain_code=child_right,
                           index=i,
                           depth=parent_key.depth + 1,
                           parent_fingerprint=parent_key.fingerprint) 
Example #2
Source File: keys.py    From multimerchant-python with MIT License 5 votes vote down vote up
def from_point(cls, point, network=BitcoinMainNet, **kwargs):
        """Create a PublicKey from a point on the SECP256k1 curve.

        :param point: A point on the SECP256k1 curve.
        :type point: SECP256k1.point
        """
        verifying_key = VerifyingKey.from_public_point(point, curve=SECP256k1)
        return cls.from_verifying_key(verifying_key, network=network, **kwargs) 
Example #3
Source File: keys.py    From bitmerchant with MIT License 5 votes vote down vote up
def from_point(cls, point, network=BitcoinMainNet, **kwargs):
        """Create a PublicKey from a point on the SECP256k1 curve.

        :param point: A point on the SECP256k1 curve.
        :type point: SECP256k1.point
        """
        verifying_key = VerifyingKey.from_public_point(point, curve=SECP256k1)
        return cls.from_verifying_key(verifying_key, network=network, **kwargs) 
Example #4
Source File: keys.py    From pywallet with MIT License 5 votes vote down vote up
def from_point(cls, point, network=BitcoinMainNet, **kwargs):
        """Create a PublicKey from a point on the SECP256k1 curve.

        :param point: A point on the SECP256k1 curve.
        :type point: SECP256k1.point
        """
        verifying_key = VerifyingKey.from_public_point(point, curve=SECP256k1)
        return cls.from_verifying_key(verifying_key, network=network, **kwargs)