Blind signature support in pyelliptic #1509
|
@ -3,8 +3,10 @@ Test for ECC blind signatures
|
|||
|
||||
"""
|
||||
import os
|
||||
import unittest
|
||||
from ctypes import cast, c_char_p
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
|
||||
from pybitmessage.pyelliptic.eccblind import ECCBlind
|
||||
from pybitmessage.pyelliptic.openssl import OpenSSL
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
|
||||
|
||||
class TestBlindSig(unittest.TestCase):
|
||||
|
@ -24,12 +26,27 @@ class TestBlindSig(unittest.TestCase):
|
|||
Shebang is not needed here. Shebang is not needed here.
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
msg = os.urandom(64)
|
||||
msg_blinded = requester_obj.create_signing_request(point_r, msg)
|
||||
Maybe Maybe `self.assertNotEqual(msg, msg_blinded)`?
Well that will always succeed as msg is a string and msg_blinded is an openssl bignum, but I can convert it before comparison, and I can also compare blinded an unblinded signature (those should both be bignums already). As I said before, there is still no serialisation for the wire protocol, as that has to be designed first, then there will be minor refactoring here. Well that will always succeed as msg is a string and msg_blinded is an openssl bignum, but I can convert it before comparison, and I can also compare blinded an unblinded signature (those should both be bignums already).
As I said before, there is still no serialisation for the wire protocol, as that has to be designed first, then there will be minor refactoring here.
They will obviously differ. That's just a tests logic (as I understand it) to compare just in case and document it. Maybe that's unnecessary. Serialization will be probably done in the They will obviously differ. That's just a tests logic (as I understand it) to compare just in case and document it. Maybe that's unnecessary.
Serialization will be probably done in the `network` package, so it's not related to the blind signature implementation itself. The signatures seems to work well. So are you going to merge this now?
I'll add the tests and then merge. I'll add the tests and then merge.
|
||||
|
||||
# check
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
msg_blinded_str = OpenSSL.malloc(0, OpenSSL.BN_num_bytes(msg_blinded))
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
OpenSSL.BN_bn2bin(msg_blinded, msg_blinded_str)
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
self.assertNotEqual(msg, cast(msg_blinded_str, c_char_p).value)
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
# (3) Signature Generation
|
||||
signature_blinded = signer_obj.blind_sign(msg_blinded)
|
||||
|
||||
# (4) Extraction
|
||||
signature = requester_obj.unblind(signature_blinded)
|
||||
|
||||
# check
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
signature_blinded_str = OpenSSL.malloc(0,
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
OpenSSL.BN_num_bytes(
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
signature_blinded))
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
signature_str = OpenSSL.malloc(0, OpenSSL.BN_num_bytes(signature[0]))
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
OpenSSL.BN_bn2bin(signature_blinded, signature_blinded_str)
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
OpenSSL.BN_bn2bin(signature[0], signature_str)
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
self.assertNotEqual(cast(signature_str, c_char_p).value,
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
cast(signature_blinded_str, c_char_p).value)
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
|
||||
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
||||
# (5) Verification
|
||||
verifier_obj = ECCBlind(pubkey=signer_obj.pubkey)
|
||||
self.assertTrue(verifier_obj.verify(msg, signature))
|
||||
|
|
|||
Shebang is not needed here. Shebang is not needed here.
Shebang is not needed here. Shebang is not needed here.
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`from pybitmessage.pyelliptic.eccblind import ECCBlind`
`self.assertTrue(blind_sig.verify())`
`self.assertTrue(blind_sig.verify())`
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
```python
def test_blind_sig(self):
"""Test full sequence using a random certifier key and a random msg"""
```
This breaks the test. This breaks the test.
This breaks the test. This breaks the test.
It depends on how you run it. It depends on how you run it.
It depends on how you run it. It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8 Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
|
Shebang is not needed here.
Shebang is not needed here.
from pybitmessage.pyelliptic.eccblind import ECCBlind
from pybitmessage.pyelliptic.eccblind import ECCBlind
self.assertTrue(blind_sig.verify())
self.assertTrue(blind_sig.verify())
If you write docstring in one line it will be shown in the test results. e.g.
If you write docstring in one line it will be shown in the test results. e.g.
This breaks the test.
This breaks the test.
It depends on how you run it.
It depends on how you run it.
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8
Travis CI should be OK, because I used such imports before: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L8