File: test_raw_auth_sym_easy.py

package info (click to toggle)
python-libnacl 2.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 488 kB
  • sloc: python: 2,634; makefile: 149; sh: 3
file content (20 lines) | stat: -rw-r--r-- 575 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Import nacl libs
import libnacl
import libnacl.utils

# Import python libs
import unittest


class TestSecretBox(unittest.TestCase):
    '''
    Test sign functions
    '''
    def test_secret_box_easy(self):
        msg = b'Are you suggesting coconuts migrate?'
        sk1 = libnacl.utils.salsa_key()
        nonce1 = libnacl.utils.rand_nonce()
        enc_msg = libnacl.crypto_secretbox_easy(msg, nonce1, sk1)
        self.assertNotEqual(msg, enc_msg)
        clear_msg = libnacl.crypto_secretbox_open_easy(enc_msg, nonce1, sk1)
        self.assertEqual(msg, clear_msg)