Esempio n. 1
0
    def create_keychain(self):
        """
        The guid generation can take a while. While it's doing that we will
        open a port to allow a UI to connect and listen for generation to
        complete.
        """
        print "Generating GUID, this may take a few minutes..."
        d = Deferred()
        api = GUIDGenerationListener(d)
        site = Site(api, timeout=None)
        connector = reactor.listenTCP(18470, site, interface="127.0.0.1")
        start = time.time()
        g = GUID()
        d.callback((round(time.time() - start, 2), connector))

        self.guid = g.guid
        self.guid_privkey = g.privkey
        self.signing_key = nacl.signing.SigningKey(self.guid_privkey)
        self.guid_signed_pubkey = g.signed_pubkey
        self.db.set_key("guid", self.guid_privkey, self.guid_signed_pubkey)

        self.bitcoin_master_privkey = bitcointools.bip32_master_key(bitcointools.sha256(self.guid_privkey))
        self.bitcoin_master_pubkey = bitcointools.bip32_privtopub(self.bitcoin_master_privkey)
        self.db.set_key("bitcoin", self.bitcoin_master_privkey, self.bitcoin_master_pubkey)

        self.encryption_key = PrivateKey(self.guid_privkey)
        self.encryption_pubkey = self.encryption_key.public_key.encode()
Esempio n. 2
0
    def create_keychain(self, callback=None):
        """
        The guid generation can take a while. While it's doing that we will
        open a port to allow a UI to connect and listen for generation to
        complete.
        """
        print "Generating GUID, this may take a few minutes..."
        g = GUID()
        self.guid = g.guid
        self.signing_key = g.signing_key
        self.verify_key = g.verify_key
        self.db.keys.set_key(
            "guid", self.signing_key.encode(encoder=nacl.encoding.HexEncoder),
            self.verify_key.encode(encoder=nacl.encoding.HexEncoder))

        self.bitcoin_master_privkey = bitcointools.bip32_master_key(
            bitcointools.sha256(self.signing_key.encode()))
        self.bitcoin_master_pubkey = bitcointools.bip32_privtopub(
            self.bitcoin_master_privkey)
        self.db.keys.set_key("bitcoin", self.bitcoin_master_privkey,
                             self.bitcoin_master_pubkey)

        self.encryption_key = self.signing_key.to_curve25519_private_key()
        self.encryption_pubkey = self.verify_key.to_curve25519_public_key()
        if callable(callback):
            callback(self, True)
Esempio n. 3
0
    def create_keychain(self):
        """
        The guid generation can take a while. While it's doing that we will
        open a port to allow a UI to connect and listen for generation to
        complete.
        """
        print "Generating GUID, this may take a few minutes..."
        d = Deferred()
        api = GUIDGenerationListener(d)
        site = Site(api, timeout=None)
        connector = reactor.listenTCP(18470, site, interface="127.0.0.1")
        start = time.time()
        g = GUID()
        d.callback((round(time.time() - start, 2), connector))

        self.guid = g.guid
        self.guid_privkey = g.privkey
        self.signing_key = nacl.signing.SigningKey(self.guid_privkey)
        self.guid_signed_pubkey = g.signed_pubkey
        self.db.set_key("guid", self.guid_privkey, self.guid_signed_pubkey)

        self.bitcoin_master_privkey = bitcointools.bip32_master_key(bitcointools.sha256(self.guid_privkey))
        self.bitcoin_master_pubkey = bitcointools.bip32_privtopub(self.bitcoin_master_privkey)
        self.db.set_key("bitcoin", self.bitcoin_master_privkey, self.bitcoin_master_pubkey)

        self.encryption_key = PrivateKey(self.guid_privkey)
        self.encryption_pubkey = self.encryption_key.public_key.encode()
Esempio n. 4
0
    def create_keychain(self, callback, heartbeat_server):
        """
        The guid generation can take a while. While it's doing that we will
        open a port to allow a UI to connect and listen for generation to
        complete.
        """
        print "Generating GUID, this may take a few minutes..."
        keystore = self.db.KeyStore()
        g = GUID()
        self.guid = g.guid
        self.signing_key = g.signing_key
        self.verify_key = g.verify_key
        keystore.set_key(
            "guid",
            self.signing_key.encode(encoder=nacl.encoding.HexEncoder),
            self.verify_key.encode(encoder=nacl.encoding.HexEncoder),
        )

        self.bitcoin_master_privkey = bitcointools.bip32_master_key(bitcointools.sha256(self.signing_key.encode()))
        self.bitcoin_master_pubkey = bitcointools.bip32_privtopub(self.bitcoin_master_privkey)
        keystore.set_key("bitcoin", self.bitcoin_master_privkey, self.bitcoin_master_pubkey)

        self.encryption_key = self.signing_key.to_curve25519_private_key()
        self.encryption_pubkey = self.verify_key.to_curve25519_public_key()
        callback(self, True)
Esempio n. 5
0
from bitcointools import random_key
from bitcointools import privtopub
from bitcointools import pubtoaddr
from bitcointools import sha256
from bitcointools import history

#priv = random_key()

priv = sha256("bticoin is ")

pub = privtopub(priv)

print(pub)

addr = pubtoaddr(pub)

print(addr)

print(history(addr))