Beispiel #1
0
def test_crypto_box_detached_invalid_sk(nonce, pk):
    with pytest.raises(AssertionError):
        crypto_box_detached(
            msg=b'foo',
            nonce=nonce,
            pk=pk,
            sk=b'',
        )
Beispiel #2
0
def test_crypto_box_detached_invalid_sk(nonce, pk):
    with pytest.raises(AssertionError):
        crypto_box_detached(
            msg=b'foo',
            nonce=nonce,
            pk=pk,
            sk=b'',
        )
Beispiel #3
0
def test_crypto_box_detached(nonce, pk, sk):
    c, mac = crypto_box_detached(
        msg=b'foo',
        nonce=nonce,
        pk=pk,
        sk=sk,
    )
    assert isinstance(c, binary_type)
    assert isinstance(mac, binary_type)
Beispiel #4
0
def test_crypto_box_detached(nonce, pk, sk):
    c, mac = crypto_box_detached(
        msg=b'foo',
        nonce=nonce,
        pk=pk,
        sk=sk,
    )
    assert isinstance(c, binary_type)
    assert isinstance(mac, binary_type)
Beispiel #5
0
def test_crypto_box_open_detached(nonce, pk, sk):
    c, mac = crypto_box_detached(
        msg=b'foo',
        nonce=nonce,
        pk=pk,
        sk=sk,
    )
    msg = crypto_box_open_detached(
        c=c,
        mac=mac,
        nonce=nonce,
        pk=pk,
        sk=sk,
    )
    assert msg == b'foo'
Beispiel #6
0
def test_crypto_box_open_detached(nonce, pk, sk):
    c, mac = crypto_box_detached(
        msg=b'foo',
        nonce=nonce,
        pk=pk,
        sk=sk,
    )
    msg = crypto_box_open_detached(
        c=c,
        mac=mac,
        nonce=nonce,
        pk=pk,
        sk=sk,
    )
    assert msg == b'foo'