bbc1.core.message_key_types 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.message_key_types.InfraMessageCategory[source]

Bases: object

Types of message for inter-core nodes messaging

CATEGORY_DATA = b'\x00\x03'
CATEGORY_DOMAIN0 = b'\x00\x04'
CATEGORY_NETWORK = b'\x00\x00'
CATEGORY_TOPOLOGY = b'\x00\x01'
CATEGORY_USER = b'\x00\x02'
class bbc1.core.message_key_types.KeyType[source]

Bases: object

Types of items in a message

admin_info = b'\x00\x00\x00\x17'
all_asset_files = b'\x00\x00\x00u'
all_included = b'\x00\x00\x00h'
anycast_ttl = b'\x00\x00\x00\x1a'
asset_file = b'\x00\x00\x00t'
asset_group_id = b'\x00\x00\x00c'
asset_group_ids = b'\x00\x00\x00d'
asset_id = b'\x00\x00\x00e'
bbc_configuration = b'\x00\x00\x00<'
command = b'\x00\x00\x00\t'
compromised_asset_files = b'\x00\x00\x00\x92'
compromised_transaction_data = b'\x00\x00\x00\x90'
compromised_transaction_ids = b'\x00\x00\x00\x93'
compromised_transactions = b'\x00\x00\x00\x91'
count = b'\x00\x00\x00\x0e'
cross_ref = b'\x00\x00\x00w'
cross_ref_verification_info = b'\x00\x00\x00{'
destination_node_id = b'\x00\x00\x00V'
destination_user_id = b'\x00\x00\x00R'
destination_user_ids = b'\x00\x00\x00S'
direction = b'\x00\x00\x00f'
domain_id = b'\x00\x00\x00P'
domain_list = b'\x00\x00\x007'
domain_ping = b'\x00\x00\x00\x15'
ecdh = b'\x00\x00\x00\x11'
external_ip4addr = b'\x00\x00\x004'
external_ip6addr = b'\x00\x00\x005'
forwarding_list = b'\x00\x00\x008'
hint = b'\x00\x00\x00\x10'
hop_count = b'\x00\x00\x00g'
infra_command = b'\x00\x00\x00\n'
infra_msg_type = b'\x00\x00\x00\x08'
ipv4_address = b'\x00\x00\x001'
ipv6_address = b'\x00\x00\x002'
is_anycast = b'\x00\x00\x00\x19'
is_replication = b'\x00\x00\x00\x1b'
ledger_subsys_manip = b'\x00\x00\x00\xa0'
ledger_subsys_register = b'\x00\x00\x00\xa1'
ledger_subsys_verify = b'\x00\x00\x00\xa2'
merkle_tree = b'\x00\x00\x00\xa3'
message = b'\x00\x00\x00\x0c'
message_seq = b'\x00\x00\x00\x14'
neighbor_list = b'\x00\x00\x00:'
node_id = b'\x00\x00\x00T'
node_info = b'\x00\x00\x006'
nodekey_signature = b'\x00\x00\x00\x16'
nonce = b'\x00\x00\x00\r'
notification_list = b'\x00\x00\x00;'
on_multinodes = b'\x00\x00\x00\x18'
outer_domain_id = b'\x00\x00\x00x'
port_number = b'\x00\x00\x003'
query_id = b'\x00\x00\x00\x0b'
random = b'\x00\x00\x00\x12'
reason = b'\x00\x00\x00\x01'
ref_index = b'\x00\x00\x00s'
result = b'\x00\x00\x00\x02'
retry_timer = b'\x00\x00\x00\x13'
signature = b'\x00\x00\x00v'
source_domain_id = b'\x00\x00\x00y'
source_node_id = b'\x00\x00\x00U'
source_user_id = b'\x00\x00\x00Q'
start_from = b'\x00\x00\x00i'
static_entry = b'\x00\x00\x000'
stats = b'\x00\x00\x00\x0f'
status = b'\x00\x00\x00\x00'
transaction_data = b'\x00\x00\x00p'
transaction_data_format = b'\x00\x00\x00|'
transaction_id = b'\x00\x00\x00a'
transaction_id_list = b'\x00\x00\x00b'
transaction_tree = b'\x00\x00\x00r'
transactions = b'\x00\x00\x00q'
txid_having_cross_ref = b'\x00\x00\x00z'
until = b'\x00\x00\x00j'
user_id = b'\x00\x00\x00`'
user_list = b'\x00\x00\x009'
class bbc1.core.message_key_types.Message[source]

Bases: object

Message parser

HEADER_LEN = 8
parse()[source]

Parse the message in the buffer

recv(dat)[source]

Append message to the buffer

class bbc1.core.message_key_types.PayloadType[source]

Bases: object

Type_any = 1
Type_binary = 0
Type_encrypted_msgpack = 3
Type_msgpack = 2
bbc1.core.message_key_types.convert_from_binary(data_type, dat)[source]

Deserialization from simple serialization

bbc1.core.message_key_types.derive_shared_key(private_key, serialized_pubkey, shared_info)[source]

Utility for deriving shared key in ECDH procedure

bbc1.core.message_key_types.deserialize_data(payload_type, dat)[source]

Utility for deserializing the received message

bbc1.core.message_key_types.get_ECDH_parameters()[source]

Utility for initialization of ECDH parameters

bbc1.core.message_key_types.make_TLV_formatted_message(msg)[source]

Utility for simple serialization function

bbc1.core.message_key_types.make_binary(dat)[source]

Simple serialize function

Basically, Type-Length-Value format is created for each item.

bbc1.core.message_key_types.make_dictionary_from_TLV_format(dat)[source]

Utility for simple deserialization function

bbc1.core.message_key_types.make_message(payload_type, msg, payload_version=0, key_name=None)[source]

Utility for making serialized message data

bbc1.core.message_key_types.set_cipher(shared_key, nonce, key_name, hint)[source]

Set shared key to the encryptor and decryptor

Encryptor and Decryptor are created for each inter-node connection

bbc1.core.message_key_types.to_2byte(val, offset=0)[source]
bbc1.core.message_key_types.to_4byte(val, offset=0)[source]
bbc1.core.message_key_types.unset_cipher(key_name)[source]