def crypto_box_open(c, nonce, pk, sk):
_assert_min_len('c', c, crypto_box_MACBYTES)
_assert_len('nonce', nonce, crypto_box_NONCEBYTES)
_assert_len('pk', pk, crypto_box_PUBLICKEYBYTES)
_assert_len('sk', sk, crypto_box_SECRETKEYBYTES)
msg = bytearray(len(c) - crypto_box_MACBYTES)
_raise_on_error(
lib.crypto_box_open_easy(
ffi.cast("unsigned char *", ffi.from_buffer(msg)),
c,
len(c),
nonce,
pk,
sk,
),
)
return binary_type(msg)
评论列表
文章目录