Ejemplo n.º 1
0
    def generate_shared_secrets(self, public_key):
        master_shared_key = ecdh(public_key, self.private_key)

        def _derived(val):
            return hmac_sha256(master_shared_key, bytearray([val]))

        self.request_encryption_key = _derived(0)
        self.request_hmac_key = _derived(1)
        self.response_encryption_key = _derived(2)
        self.response_hmac_key = _derived(3)
Ejemplo n.º 2
0
 def get_shared_nonce(self, pubkey: bytes, script: bytes) -> bytes:
     our_privkey = self.get_private_blinding_key(script)
     nonce = wally.sha256(wally.ecdh(pubkey, our_privkey))
     return nonce