Skip to content

Commit 8039372

Browse files
committed
Started a dummy test for random keys in pyelliptic.ECC()
1 parent 46c15e8 commit 8039372

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/pyelliptic/tests/test_openssl.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import unittest
55

66
try:
7+
from pyelliptic.ecc import ECC
78
from pyelliptic.openssl import OpenSSL
89
except ImportError:
9-
from pybitmessage.pyelliptic import OpenSSL
10+
from pybitmessage.pyelliptic import ECC, OpenSSL
1011

1112
try:
1213
OpenSSL.BN_bn2binpad
@@ -55,3 +56,10 @@ def test_padding(self):
5556
if b.raw != c.raw.rjust(OpenSSL.BN_num_bytes(n), b'\x00'):
5657
bad += 1
5758
self.assertEqual(bad, 0)
59+
60+
def test_random_keys(self):
61+
"""A dummy test for random keys in ECC object"""
62+
eccobj = ECC(curve='secp256k1')
63+
self.assertEqual(len(eccobj.privkey), 32)
64+
pubkey = eccobj.get_pubkey()
65+
self.assertEqual(pubkey[:4], b'\x02\xca\x00\x20')

0 commit comments

Comments
 (0)