Skip to content

Commit

Permalink
Fix python3 issues in test_blindsig:
Browse files Browse the repository at this point in the history
 - simplify imports
 - signatures are of type bytes
 - chain kwarg of pyelliptic.ECCBlindChain is bytes
  • Loading branch information
g1itch committed Feb 18, 2021
1 parent faed885 commit 0f8528c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/tests/test_blindsig.py
Expand Up @@ -5,9 +5,7 @@
import unittest
from hashlib import sha256

from pybitmessage.pyelliptic.eccblind import ECCBlind
from pybitmessage.pyelliptic.eccblindchain import ECCBlindChain
from pybitmessage.pyelliptic.openssl import OpenSSL
from pybitmessage.pyelliptic import ECCBlind, ECCBlindChain, OpenSSL

# pylint: disable=protected-access

Expand Down Expand Up @@ -36,12 +34,12 @@ def test_blind_sig(self):

# (3) Signature Generation
signature_blinded = signer_obj.blind_sign(msg_blinded)
assert isinstance(signature_blinded, str)
assert isinstance(signature_blinded, bytes)
self.assertEqual(len(signature_blinded), 32)

# (4) Extraction
signature = requester_obj.unblind(signature_blinded)
assert isinstance(signature, str)
assert isinstance(signature, bytes)
self.assertEqual(len(signature), 65)

self.assertNotEqual(signature, signature_blinded)
Expand Down Expand Up @@ -163,7 +161,7 @@ def test_blind_sig_chain(self): # pylint: disable=too-many-locals
output.extend(pubkey)
output.extend(signature)
signer_obj = child_obj
verifychain = ECCBlindChain(ca=ca.pubkey(), chain=str(output))
verifychain = ECCBlindChain(ca=ca.pubkey(), chain=bytes(output))
self.assertTrue(verifychain.verify(msg=msg, value=1))

def test_blind_sig_chain_wrong_ca(self): # pylint: disable=too-many-locals
Expand Down

0 comments on commit 0f8528c

Please sign in to comment.