def test_string_to_signature(self): with open(self.channel_tx, 'rb') as f: channel_tx = f.read() channel_config = utils.extract_channel_config(channel_tx) client = Client() client.state_store = FileKeyValueStore(self.kv_store_path) orderer_org_admin = get_orderer_org_admin(client) orderer_org_admin_tx_context = \ TXContext(orderer_org_admin, Ecies(), {}) client.tx_context = orderer_org_admin_tx_context orderer_org_admin_signature = client.sign_channel_config( channel_config) orderer_org_admin_signature_bytes = \ orderer_org_admin_signature.SerializeToString() proto_signature = utils.string_to_signature( [orderer_org_admin_signature_bytes]) self.assertIsInstance(proto_signature, list) self.assertTrue( 'OrdererMSP' in proto_signature[0].signature_header.__str__())
def test_build_header(self): timestamp = utils.current_timestamp() client = Client() client.state_store = FileKeyValueStore(self.kv_store_path) orderer_org_admin = get_orderer_org_admin(client) orderer_org_admin_tx_context = \ TXContext(orderer_org_admin, Ecies(), {}) client.tx_context = orderer_org_admin_tx_context orderer_org_admin_serialized = utils.create_serialized_identity( orderer_org_admin) serialized_identity = identities_pb2.SerializedIdentity() serialized_identity.ParseFromString(orderer_org_admin_serialized) proto_channel_header = utils.build_channel_header( common_pb2.HeaderType.Value('CONFIG_UPDATE'), orderer_org_admin_tx_context.tx_id, self.channel_id, timestamp ) channel_header = utils.build_header( orderer_org_admin_tx_context.identity, proto_channel_header, orderer_org_admin_tx_context.nonce ) self.assertIsInstance(channel_header, common_pb2.Header)
def test_string_to_signature(self): with open(self.channel_tx, 'rb') as f: channel_tx = f.read() channel_config = utils.extract_channel_config(channel_tx) client = Client('test/fixtures/network.json') orderer_org_admin = get_orderer_org_user( state_store=client.state_store) orderer_org_admin_tx_context = \ TXContext(orderer_org_admin, Ecies(), {}) client.tx_context = orderer_org_admin_tx_context orderer_org_admin_signature = client.sign_channel_config( channel_config) proto_signature = utils.string_to_signature( [orderer_org_admin_signature]) self.assertIsInstance(proto_signature, list) self.assertTrue( 'OrdererMSP' in proto_signature[0].signature_header.__str__())