INNER CODE UNIT · C

publickey

jedisct1/libsodium-php · libsodium.c:1107

    publickey = keypair + crypto_box_SECRETKEYBYTES;
    if (SIZE_MAX - msg_len <= crypto_box_MACBYTES) {
        zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
        return;
    }
    ciphertext = zend_string_checked_alloc((size_t) msg_len + crypto_box_MACBYTES, 0);
    if (crypto_box_easy((unsigned char *) ZSTR_VAL(ciphertext), msg,
                        (unsigned long long) msg_len,
                        nonce, publickey, secretkey) != 0) {
        zend_string_free(ciphertext);
        zend_throw_exception(sodium_exception_ce, "internal error", 0);
        return;
    }

    RETURN_STR(ciphertext);
}

PHP_FUNCTION(sodium_crypto_box_open)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…