============================= test session starts ==============================
platform linux2 -- Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
rootdir: /home/k0rx/pyaxo, inifile: 
collected 22 items

test_db.py ..FF..F.F.....
test_states.py ........

=================================== FAILURES ===================================
________________ TestDefaultDatabase.test_passphrase[None-123] _________________

self = <tests.test_db.TestDefaultDatabase instance at 0x7f5d19dc5710>
passphrase_0 = None, passphrase_1 = '123'

    @pytest.mark.parametrize('passphrase_1', PASSPHRASES)
    @pytest.mark.parametrize('passphrase_0', PASSPHRASES)
    def test_passphrase(self, passphrase_0, passphrase_1):
        a = Axolotl('Angie', dbpassphrase=passphrase_0)
        b = Axolotl('Barb', dbpassphrase=None)
    
        a.initState(other_name=b.name,
                    other_identityKey=b.state['DHIs'],
                    other_handshakeKey=b.handshakePKey,
                    other_ratchetKey=b.state['DHRs'],
                    verify=False)
        a.saveState()
    
        if passphrase_0 == passphrase_1:
            a = Axolotl('Angie', dbpassphrase=passphrase_1)
            assert isinstance(a.db, sqlite3.Connection)
        else:
            with pytest.raises(SystemExit):
>               a = Axolotl('Angie', dbpassphrase=passphrase_1)

test_db.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../pyaxo.py:68: in __init__
    self.db = self.openDB()
../pyaxo.py:548: in openDB
    sql = box.decrypt(ciphertext)
/usr/local/lib/python2.7/dist-packages/nacl/secret.py:119: in decrypt
    nonce, self._key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ciphertext = 'E TABLE conversations (\n                        my_identity TEXT,\n                        other_identity TEXT,\n   ...            conversations (\n                        my_identity,\n                        other_identity);\nCOMMIT;\n'
nonce = 'BEGIN TRANSACTION;\nCREAT'
key = '\xa6e\xa4Y B/\x9dA~Hg\xef\xdcO\xb8\xa0J\x1f?\xff\x1f\xa0~\x99\x8e\x86\xf7\xf7\xa2z\xe3'

    def crypto_secretbox_open(ciphertext, nonce, key):
        """
        Decrypt and returns the encrypted message ``ciphertext`` with the secret
        ``key`` and the nonce ``nonce``.
    
        :param ciphertext: bytes
        :param nonce: bytes
        :param key: bytes
        :rtype: bytes
        """
        if len(key) != crypto_secretbox_KEYBYTES:
            raise ValueError("Invalid key")
    
        if len(nonce) != crypto_secretbox_NONCEBYTES:
            raise ValueError("Invalid nonce")
    
        padded = b"\x00" * crypto_secretbox_BOXZEROBYTES + ciphertext
        plaintext = ffi.new("unsigned char[]", len(padded))
    
        if lib.crypto_secretbox_open(
                plaintext, padded, len(padded), nonce, key) != 0:
>           raise CryptoError("Decryption failed. Ciphertext failed verification")
E           CryptoError: Decryption failed. Ciphertext failed verification

/usr/local/lib/python2.7/dist-packages/nacl/bindings/crypto_secretbox.py:74: CryptoError
________________ TestDefaultDatabase.test_passphrase[None-321] _________________

self = <tests.test_db.TestDefaultDatabase instance at 0x7f5d19958680>
passphrase_0 = None, passphrase_1 = '321'

    @pytest.mark.parametrize('passphrase_1', PASSPHRASES)
    @pytest.mark.parametrize('passphrase_0', PASSPHRASES)
    def test_passphrase(self, passphrase_0, passphrase_1):
        a = Axolotl('Angie', dbpassphrase=passphrase_0)
        b = Axolotl('Barb', dbpassphrase=None)
    
        a.initState(other_name=b.name,
                    other_identityKey=b.state['DHIs'],
                    other_handshakeKey=b.handshakePKey,
                    other_ratchetKey=b.state['DHRs'],
                    verify=False)
        a.saveState()
    
        if passphrase_0 == passphrase_1:
            a = Axolotl('Angie', dbpassphrase=passphrase_1)
            assert isinstance(a.db, sqlite3.Connection)
        else:
            with pytest.raises(SystemExit):
>               a = Axolotl('Angie', dbpassphrase=passphrase_1)

test_db.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../pyaxo.py:68: in __init__
    self.db = self.openDB()
../pyaxo.py:548: in openDB
    sql = box.decrypt(ciphertext)
/usr/local/lib/python2.7/dist-packages/nacl/secret.py:119: in decrypt
    nonce, self._key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ciphertext = 'E TABLE conversations (\n                        my_identity TEXT,\n                        other_identity TEXT,\n   ...            conversations (\n                        my_identity,\n                        other_identity);\nCOMMIT;\n'
nonce = 'BEGIN TRANSACTION;\nCREAT'
key = '\x8d#\xcfl\x86\xe84\xa7\xaan\xde\xd5L&\xce+\xb2\xe7I\x03S\x8ca\xbd\xd5\xd2\x19y\x97\xab/r'

    def crypto_secretbox_open(ciphertext, nonce, key):
        """
        Decrypt and returns the encrypted message ``ciphertext`` with the secret
        ``key`` and the nonce ``nonce``.
    
        :param ciphertext: bytes
        :param nonce: bytes
        :param key: bytes
        :rtype: bytes
        """
        if len(key) != crypto_secretbox_KEYBYTES:
            raise ValueError("Invalid key")
    
        if len(nonce) != crypto_secretbox_NONCEBYTES:
            raise ValueError("Invalid nonce")
    
        padded = b"\x00" * crypto_secretbox_BOXZEROBYTES + ciphertext
        plaintext = ffi.new("unsigned char[]", len(padded))
    
        if lib.crypto_secretbox_open(
                plaintext, padded, len(padded), nonce, key) != 0:
>           raise CryptoError("Decryption failed. Ciphertext failed verification")
E           CryptoError: Decryption failed. Ciphertext failed verification

/usr/local/lib/python2.7/dist-packages/nacl/bindings/crypto_secretbox.py:74: CryptoError
_________________ TestDefaultDatabase.test_passphrase[123-321] _________________

self = <tests.test_db.TestDefaultDatabase instance at 0x7f5d198c2878>
passphrase_0 = '123', passphrase_1 = '321'

    @pytest.mark.parametrize('passphrase_1', PASSPHRASES)
    @pytest.mark.parametrize('passphrase_0', PASSPHRASES)
    def test_passphrase(self, passphrase_0, passphrase_1):
        a = Axolotl('Angie', dbpassphrase=passphrase_0)
        b = Axolotl('Barb', dbpassphrase=None)
    
        a.initState(other_name=b.name,
                    other_identityKey=b.state['DHIs'],
                    other_handshakeKey=b.handshakePKey,
                    other_ratchetKey=b.state['DHRs'],
                    verify=False)
        a.saveState()
    
        if passphrase_0 == passphrase_1:
            a = Axolotl('Angie', dbpassphrase=passphrase_1)
            assert isinstance(a.db, sqlite3.Connection)
        else:
            with pytest.raises(SystemExit):
>               a = Axolotl('Angie', dbpassphrase=passphrase_1)

test_db.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../pyaxo.py:68: in __init__
    self.db = self.openDB()
../pyaxo.py:548: in openDB
    sql = box.decrypt(ciphertext)
/usr/local/lib/python2.7/dist-packages/nacl/secret.py:119: in decrypt
    nonce, self._key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ciphertext = '\xc8=\xce\xa8\xd1\x91\xed\xbd\x7f\x00%{~L\x86<\xa0\x86\x9c5+\xa5\xc9\x8bY\x03GE\xe6\x86=\xda\xd4\xa9\x99*\xe6\xab-1\x...ad~&+\xf93\xd2"\xea\x87V\x97\xddK\xf9v\xa6,\x02\x06l\xd0{\x0e\x05!\x08\xcas\xdet\x1dIM\x8br(\x8d\r\x0fEp\xde\x14)\xf3v'
nonce = "-g~\xf8\x1a\xa2R\xf8\xf9V8\xab\x99\xe0\x1eAR\xad\x03\xf7'\xe3\x17\xce"
key = '\x8d#\xcfl\x86\xe84\xa7\xaan\xde\xd5L&\xce+\xb2\xe7I\x03S\x8ca\xbd\xd5\xd2\x19y\x97\xab/r'

    def crypto_secretbox_open(ciphertext, nonce, key):
        """
        Decrypt and returns the encrypted message ``ciphertext`` with the secret
        ``key`` and the nonce ``nonce``.
    
        :param ciphertext: bytes
        :param nonce: bytes
        :param key: bytes
        :rtype: bytes
        """
        if len(key) != crypto_secretbox_KEYBYTES:
            raise ValueError("Invalid key")
    
        if len(nonce) != crypto_secretbox_NONCEBYTES:
            raise ValueError("Invalid nonce")
    
        padded = b"\x00" * crypto_secretbox_BOXZEROBYTES + ciphertext
        plaintext = ffi.new("unsigned char[]", len(padded))
    
        if lib.crypto_secretbox_open(
                plaintext, padded, len(padded), nonce, key) != 0:
>           raise CryptoError("Decryption failed. Ciphertext failed verification")
E           CryptoError: Decryption failed. Ciphertext failed verification

/usr/local/lib/python2.7/dist-packages/nacl/bindings/crypto_secretbox.py:74: CryptoError
_________________ TestDefaultDatabase.test_passphrase[321-123] _________________

self = <tests.test_db.TestDefaultDatabase instance at 0x7f5d199304d0>
passphrase_0 = '321', passphrase_1 = '123'

    @pytest.mark.parametrize('passphrase_1', PASSPHRASES)
    @pytest.mark.parametrize('passphrase_0', PASSPHRASES)
    def test_passphrase(self, passphrase_0, passphrase_1):
        a = Axolotl('Angie', dbpassphrase=passphrase_0)
        b = Axolotl('Barb', dbpassphrase=None)
    
        a.initState(other_name=b.name,
                    other_identityKey=b.state['DHIs'],
                    other_handshakeKey=b.handshakePKey,
                    other_ratchetKey=b.state['DHRs'],
                    verify=False)
        a.saveState()
    
        if passphrase_0 == passphrase_1:
            a = Axolotl('Angie', dbpassphrase=passphrase_1)
            assert isinstance(a.db, sqlite3.Connection)
        else:
            with pytest.raises(SystemExit):
>               a = Axolotl('Angie', dbpassphrase=passphrase_1)

test_db.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../pyaxo.py:68: in __init__
    self.db = self.openDB()
../pyaxo.py:548: in openDB
    sql = box.decrypt(ciphertext)
/usr/local/lib/python2.7/dist-packages/nacl/secret.py:119: in decrypt
    nonce, self._key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ciphertext = '\xc7\xedU\x07\xa4\x8f\xbf\xd3Y\xaa\xbf>(\x7f\xab\xac\x9a\x16\xedf&nc\xd0\xa0\x9fS\x9fX\xab\xb5\xec\x04$\x00\xab\xb1qL...\x87\xd5\x06Xe&\xf8l\xe1\x17\xbfH8[6\xf8\xb3q{I:\xac"X\xc7D^\xbe\xb8\xb9|\x07\xf8\x83=#"\x90\xacs\xc9\x08\xf3\xb8\xdea'
nonce = '\x88OX\x8b\xa1\xbbv\xdb\xa9\x9d\xd3\xc8&\x81\xf8\xcc\x17\xb0|\x10\xbb4\xect'
key = '\xa6e\xa4Y B/\x9dA~Hg\xef\xdcO\xb8\xa0J\x1f?\xff\x1f\xa0~\x99\x8e\x86\xf7\xf7\xa2z\xe3'

    def crypto_secretbox_open(ciphertext, nonce, key):
        """
        Decrypt and returns the encrypted message ``ciphertext`` with the secret
        ``key`` and the nonce ``nonce``.
    
        :param ciphertext: bytes
        :param nonce: bytes
        :param key: bytes
        :rtype: bytes
        """
        if len(key) != crypto_secretbox_KEYBYTES:
            raise ValueError("Invalid key")
    
        if len(nonce) != crypto_secretbox_NONCEBYTES:
            raise ValueError("Invalid nonce")
    
        padded = b"\x00" * crypto_secretbox_BOXZEROBYTES + ciphertext
        plaintext = ffi.new("unsigned char[]", len(padded))
    
        if lib.crypto_secretbox_open(
                plaintext, padded, len(padded), nonce, key) != 0:
>           raise CryptoError("Decryption failed. Ciphertext failed verification")
E           CryptoError: Decryption failed. Ciphertext failed verification

/usr/local/lib/python2.7/dist-packages/nacl/bindings/crypto_secretbox.py:74: CryptoError
===================== 4 failed, 18 passed in 0.56 seconds ======================
