You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use crypto_box and crypto_box_open to let party A encrypt and sign data for party B.
From my understanding, the following code should work:
def test_cross_box():
pkA, skA = pysodium.crypto_sign_keypair()
pkB, skB = pysodium.crypto_sign_keypair()
nonce = pysodium.randombytes(pysodium.crypto_box_NONCEBYTES)
msg = "foo"
c = pysodium.crypto_box(msg, nonce, pkB, skA)
d = pysodium.crypto_box_open(c, nonce, pkA, skB)
assert msg == d
However, the above code raises a ValueError in /usr/local/lib/python2.7/site-packages/pysodium/__init__.py:256: in crypto_box_open __check(sodium.crypto_box_open(msg, padded, ctypes.c_ulonglong(len(padded)), nonce, pk, sk))
The unit test only seems to check for cases where the public and secret key are the same when calling crypto_box and crypto_box_open, and indeed the following code works:
def test_self_box():
pkA, skA = pysodium.crypto_sign_keypair()
nonce = pysodium.randombytes(pysodium.crypto_box_NONCEBYTES)
msg = "foo"
c = pysodium.crypto_box(msg, nonce, pkA, skA)
d = pysodium.crypto_box_open(c, nonce, pkA, skA)
assert msg == d
Am I missing something about how crypto_box should be used, or is this a bug?
Using python 2.7, pysodium 0.6.8, libsodium 1.0.9
The text was updated successfully, but these errors were encountered:
I'm trying to use
crypto_box
andcrypto_box_open
to let party A encrypt and sign data for party B.From my understanding, the following code should work:
However, the above code raises a
ValueError
in/usr/local/lib/python2.7/site-packages/pysodium/__init__.py:256: in crypto_box_open __check(sodium.crypto_box_open(msg, padded, ctypes.c_ulonglong(len(padded)), nonce, pk, sk))
The unit test only seems to check for cases where the public and secret key are the same when calling
crypto_box
andcrypto_box_open
, and indeed the following code works:Am I missing something about how
crypto_box
should be used, or is this a bug?Using python 2.7, pysodium 0.6.8, libsodium 1.0.9
The text was updated successfully, but these errors were encountered: