Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP 8.4] Add new Sodium functions and constants #3878

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions reference/sodium/constants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,94 @@
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis128l-keybytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS128L_KEYBYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis128l-nsecbytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS128L_NSECBYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis128l-npubbytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS128L_NPUBBYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis128l-abytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS128L_ABYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis256-keybytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS256_KEYBYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis256-nsecbytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS256_NSECBYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis256-npubbytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS256_NPUBBYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aegis256-abytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AEGIS256_ABYTES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.sodium-crypto-aead-aes256gcm-keybytes">
<term>
<constant>SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES</constant>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sodium-crypto-aead-aegis128l-decrypt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sodium_crypto_aead_aegis128l_decrypt</refname>
<refpurpose>Verify then decrypt a message with AEGIS-128L</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>string</type><type>false</type></type><methodname>sodium_crypto_aead_aegis128l_decrypt</methodname>
<methodparam><type>string</type><parameter>ciphertext</parameter></methodparam>
<methodparam><type>string</type><parameter>additional_data</parameter></methodparam>
<methodparam><type>string</type><parameter>nonce</parameter></methodparam>
<methodparam><modifier role="attribute">#[\SensitiveParameter]</modifier><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<simpara>
Verify then decrypt a message with AEGIS-128L.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>ciphertext</parameter></term>
<listitem>
<simpara>
Must be in the format provided by <function>sodium_crypto_aead_aegis128l_encrypt</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>additional_data</parameter></term>
<listitem>
<simpara>
Additional, authenticated data. This is used in the verification of the authentication tag
appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>nonce</parameter></term>
<listitem>
<simpara>
A number that must be only used once, per message.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<simpara>
Encryption key (128-bit).
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns the plaintext on success, &return.falseforfailure;.
</simpara>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>sodium_crypto_aead_aegis128l_encrypt</function></member>
<member><function>sodium_crypto_aead_aegis128l_keygen</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sodium-crypto-aead-aegis128l-encrypt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sodium_crypto_aead_aegis128l_encrypt</refname>
<refpurpose>Encrypt then authenticate a message with AEGIS-128L</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>sodium_crypto_aead_aegis128l_encrypt</methodname>
<methodparam><modifier role="attribute">#[\SensitiveParameter]</modifier><type>string</type><parameter>message</parameter></methodparam>
<methodparam><type>string</type><parameter>additional_data</parameter></methodparam>
<methodparam><type>string</type><parameter>nonce</parameter></methodparam>
<methodparam><modifier role="attribute">#[\SensitiveParameter]</modifier><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<simpara>
Encrypt then authenticate a message with AEGIS-128L.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>message</parameter></term>
<listitem>
<simpara>
The plaintext message to encrypt.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>additional_data</parameter></term>
<listitem>
<simpara>
Additional, authenticated data. This is used in the verification of the authentication tag
appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>nonce</parameter></term>
<listitem>
<simpara>
A number that must be only used once, per message.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<simpara>
Encryption key (128-bit).
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns the ciphertext and authentication tag as a string of raw binary bytes.
</simpara>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>sodium_crypto_aead_aegis128l_decrypt</function></member>
<member><function>sodium_crypto_aead_aegis128l_keygen</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
60 changes: 60 additions & 0 deletions reference/sodium/functions/sodium-crypto-aead-aegis128l-keygen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sodium-crypto-aead-aegis128l-keygen" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sodium_crypto_aead_aegis128l_keygen</refname>
<refpurpose>Generate a random AEGIS-128L key</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>sodium_crypto_aead_aegis128l_keygen</methodname>
<void/>
</methodsynopsis>
<simpara>
Generate a random key for use with <function>sodium_crypto_aead_aegis128l_encrypt</function> and
<function>sodium_crypto_aead_aegis128l_decrypt</function>.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns a 128-bit random key.
</simpara>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>sodium_crypto_aead_aegis128l_decrypt</function></member>
<member><function>sodium_crypto_aead_aegis128l_encrypt</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Loading