mirror of https://github.com/nucypher/nucypher.git
test_default_crypto - symmetric crypto
parent
60c939a021
commit
55dbfdd8e0
|
@ -10,7 +10,7 @@ default_algorithm = dict(
|
|||
symmetric=dict(
|
||||
cipher='nacl'),
|
||||
pre=dict(
|
||||
cipher='bbs98',
|
||||
cipher='bbs98', # BBS98 is only temporary here, for development
|
||||
curve=714, # secp256k1 in OpenSSL
|
||||
g=b'1:' + _bitcoin_genesis,
|
||||
m=None, n=None))
|
||||
|
|
4
setup.py
4
setup.py
|
@ -1,4 +1,4 @@
|
|||
from distutils.core import setup
|
||||
from distutils.core import setup, find_packages
|
||||
|
||||
INSTALL_REQUIRES = [
|
||||
'kademlia>=1.0',
|
||||
|
@ -27,4 +27,4 @@ setup(name='nkms',
|
|||
install_requires=INSTALL_REQUIRES,
|
||||
dependency_links=LINKS,
|
||||
extras_require={'testing': TESTS_REQUIRE},
|
||||
packages=['nkms'])
|
||||
packages=find_packages())
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
from nkms.crypto import default_algorithm
|
||||
from nkms.crypto import symmetric_from_algorithm
|
||||
from nkms import crypto
|
||||
|
||||
|
||||
def test_symmetric():
|
||||
Cipher = symmetric_from_algorithm(default_algorithm)
|
||||
key = crypto.random(Cipher.KEY_SIZE)
|
||||
cipher = Cipher(key)
|
||||
data = b'Hello world' * 10
|
||||
|
||||
edata = cipher.encrypt(data)
|
||||
assert edata != data
|
||||
assert cipher.decrypt(edata) == data
|
Loading…
Reference in New Issue