bbc1.core.key_exchange_manager module

Copyright (c) 2017 beyond-blockchain.org.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class bbc1.core.key_exchange_manager.KeyExchangeManager(networking, domain_id, counter_node_id)[source]

Bases: object

ECDH (Elliptic Curve Diffie-Hellman) key exchange manager

KEY_EXCHANGE_INVOKE_MAX_BACKOFF = 6
KEY_EXCHANGE_RETRY_INTERVAL = 5
KEY_OBSOLETE_TIMER = 10
KEY_REFRESH_INTERVAL = 604800
STATE_CONFIRMING = 2
STATE_ESTABLISHED = 3
STATE_NONE = 0
STATE_REQUESTING = 1
receive_confirmation()[source]

Confirm that the key has been agreed

receive_exchange_request(pubkey, nonce, random_val, hint)[source]

Procedure when receiving message with BBcNetwork.REQUEST_KEY_EXCHANGE

Parameters:
  • pubkey (bytes) – public key
  • nonce (bytes) – nonce value
  • random_val (bytes) – random value in calculating key
receive_exchange_response(pubkey, random_val, hint)[source]

Process ECDH procedure (receiving response)

set_cipher(key_name, hint)[source]

Set key to the encryptor and decryptor

set_invoke_timer(timeout, retry_entry=False)[source]

Set timer for key refreshment

stop_all_timers()[source]

Stop all timers

unset_cipher(key_name=None)[source]

Unset key from the encryptor and decryptor

bbc1.core.key_exchange_manager.remove_old_key(query_entry)[source]