How to use the iroha.helper.crypto.sign_hash function in iroha

To help you get started, we’ve selected a few iroha examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / iroha-python / tests / primitive / test_signatories.py View on Github external
payload = Transaction.Payload(
                creator_account_id = "test@test"
            ),
            signatures = []
        )

        signatories.sign(tx)

        self.assertEqual(len(tx.signatures),3)
        for i in range(0,3):
            sig = tx.signatures[i]
            self.assertTrue(
                crypto.verify(
                    sig.pubkey,
                    sig.signature,
                    crypto.sign_hash(tx.payload)
                )
            )

            self.assertEqual(
                sig.signature,
                crypto.sign(
                    keypairs[i],
                    crypto.sign_hash(tx.payload)
                )
            )

        signatories.clean()
        self.assertEqual(signatories.size(),0)
github hyperledger / iroha-python / tests / helper / test_crypt.py View on Github external
def test_sign_hash(self):
        hash = crypto.sign_hash(self.tx.payload)

        logger.info(hash)
        logger.info(crypto.b64encode(hash))

        sign = crypto.sign(self.keypair,hash)

        logger.info(sign)

        is_verify = crypto.verify(self.keypair.public_key,sign,hash)

        logger.info(is_verify)
        self.assertTrue(is_verify)
github hyperledger / iroha-python / tests / test_creator.py View on Github external
creator_account_id = "test@test",
                    created_time = tx.debug_proto_transaction().payload.created_time
                ),
                signatures = [
                    Signature(
                        pubkey = keypairs[0].public_key,
                        signature = crypto.sign(
                            keypairs[0],
                            crypto.sign_hash(tx.debug_proto_transaction().payload)
                        )
                    ),
                    Signature(
                        pubkey = keypairs[1].public_key,
                        signature = crypto.sign(
                            keypairs[1],
                            crypto.sign_hash(tx.debug_proto_transaction().payload)
                        )
github hyperledger / iroha-python / tests / primitive / test_signatories.py View on Github external
self.assertEqual(len(tx.signatures),3)
        for i in range(0,3):
            sig = tx.signatures[i]
            self.assertTrue(
                crypto.verify(
                    sig.pubkey,
                    sig.signature,
                    crypto.sign_hash(tx.payload)
                )
            )

            self.assertEqual(
                sig.signature,
                crypto.sign(
                    keypairs[i],
                    crypto.sign_hash(tx.payload)
                )
            )

        signatories.clean()
        self.assertEqual(signatories.size(),0)
github hyperledger / iroha-python / tests / helper / test_stateless_validator.py View on Github external
payload = Transaction.Payload(
            commands = [
                Command(create_account = create_ac)
            ],
            creator_account_id = self.creator,
            tx_counter = self.tx_counter,
            created_time = crypto.now()+3600*24*1000*10
        )

        tx = Transaction(
            payload = payload,
            signatures = [
                Signature(
                    pubkey = self.keypair.public_key,
                    signature = crypto.sign(self.keypair,crypto.sign_hash(payload))
                )
            ]
        )
        self.assertFalse(stateless_validator.verify(tx))