Actually document openssl_cms_*() functions

This commit is contained in:
Christoph M. Becker 2021-01-04 13:04:55 +01:00
parent bcd51bdf1d
commit ad0175ba44
5 changed files with 558 additions and 0 deletions

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.openssl-cms-decrypt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>openssl_cms_decrypt</refname>
<refpurpose>Decrypt a CMS message</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>openssl_cms_decrypt</methodname>
<methodparam><type>string</type><parameter>input_filename</parameter></methodparam>
<methodparam><type>string</type><parameter>output_filename</parameter></methodparam>
<methodparam><type class="union"><type>OpenSSLCertificate</type><type>string</type></type><parameter>certificate</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>OpenSSLAsymmetricKey</type><type>OpenSSLCertificate</type><type>array</type><type>string</type><type>null</type></type><parameter>private_key</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>encoding</parameter><initializer><constant>OPENSSL_ENCODING_SMIME</constant></initializer></methodparam>
</methodsynopsis>
<para>
Decrypts a CMS message.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>input_filename</parameter></term>
<listitem>
<para>
The name of a file containing encrypted content.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>output_filename</parameter></term>
<listitem>
<para>
The name of the file to deposit the decrypted content.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>certificate</parameter></term>
<listitem>
<para>
The name of the file containing a certificate of the recipient.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>private_key</parameter></term>
<listitem>
<para>
The name of the file containing a PKCS#8 key.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
<para>
The encoding of the input file. One of <constant>OPENSSL_CMS_SMIME</constant>,
<constant>OPENSLL_CMS_DER</constant> or <constant>OPENSSL_CMS_PEM</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</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
-->

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.openssl-cms-encrypt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>openssl_cms_encrypt</refname>
<refpurpose>Encrypt a CMS message</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>openssl_cms_encrypt</methodname>
<methodparam><type>string</type><parameter>input_filename</parameter></methodparam>
<methodparam><type>string</type><parameter>output_filename</parameter></methodparam>
<methodparam><type class="union"><type>OpenSSLCertificate</type><type>array</type><type>string</type></type><parameter>certificate</parameter></methodparam>
<methodparam><type class="union"><type>array</type><type>null</type></type><parameter>headers</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>encoding</parameter><initializer><constant>OPENSSL_ENCODING_SMIME</constant></initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>cipher_algo</parameter><initializer><constant>OPENSSL_CIPHER_RC2_40</constant></initializer></methodparam>
</methodsynopsis>
<para>
This function encrypts content to one or more recipients,
based on the certificates that are passed to it.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>input_filename</parameter></term>
<listitem>
<para>
The file to be encrypted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>output_filename</parameter></term>
<listitem>
<para>
The output file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>certificate</parameter></term>
<listitem>
<para>
Recipients to encrypt to.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>headers</parameter></term>
<listitem>
<para>
Headers to include when S/MIME is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
Flags to be passed to CMS_sign.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
<para>
An encoding to output. One of <constant>OPENSSL_CMS_SMIME</constant>,
<constant>OPENSLL_CMS_DER</constant> or <constant>OPENSSL_CMS_PEM</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>cipher_algo</parameter></term>
<listitem>
<para>
A cypher to use.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</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
-->

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.openssl-cms-read" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>openssl_cms_read</refname>
<refpurpose>Export the CMS file to an array of PEM certificates</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>openssl_cms_read</methodname>
<methodparam><type>string</type><parameter>input_filename</parameter></methodparam>
<methodparam><type>array</type><parameter role="reference">certificates</parameter></methodparam>
</methodsynopsis>
<para>
Performs the exact analog to <function>openssl_pkcs7_read</function>.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>input_filename</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>certificates</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</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
-->

View file

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.openssl-cms-sign" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>openssl_cms_sign</refname>
<refpurpose>Sign a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>openssl_cms_sign</methodname>
<methodparam><type>string</type><parameter>input_filename</parameter></methodparam>
<methodparam><type>string</type><parameter>output_filename</parameter></methodparam>
<methodparam><type class="union"><type>OpenSSLCertificate</type><type>string</type></type><parameter>certificate</parameter></methodparam>
<methodparam><type class="union"><type>OpenSSLAsymmetricKey</type><type>OpenSSLCertificate</type><type>array</type><type>string</type></type><parameter>private_key</parameter></methodparam>
<methodparam><type class="union"><type>array</type><type>null</type></type><parameter>headers</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>encoding</parameter><initializer><constant>OPENSSL_ENCODING_SMIME</constant></initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>untrusted_certificates_filename</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
This function signs a file with an X.509 certificate and key.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>input_filename</parameter></term>
<listitem>
<para>
The name of the file to be signed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>output_filename</parameter></term>
<listitem>
<para>
The name of the file to deposit the results.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>certificate</parameter></term>
<listitem>
<para>
The name of the file containing the signing certificate.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>private_key</parameter></term>
<listitem>
<para>
The name of file containing the key associated with <parameter>certificate</parameter>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>headers</parameter></term>
<listitem>
<para>
An array of headers to be included in S/MIME output.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
Flags to be passed to <function>cms_sign</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
<para>
The encoding of the output file. One of <constant>OPENSSL_CMS_SMIME</constant>,
<constant>OPENSLL_CMS_DER</constant> or <constant>OPENSSL_CMS_PEM</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>untrusted_certificates_filename</parameter></term>
<listitem>
<para>
Intermediate certificates to be included in the signature.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</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
-->

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.openssl-cms-verify" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>openssl_cms_verify</refname>
<refpurpose>Verify a CMS signature</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>openssl_cms_verify</methodname>
<methodparam><type>string</type><parameter>input_filename</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>certificates</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>array</type><parameter>ca_info</parameter><initializer>[]</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>untrusted_certificates_filename</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>content</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>pk7</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>sigfile</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>encoding</parameter><initializer><constant>OPENSSL_ENCODING_SMIME</constant></initializer></methodparam>
</methodsynopsis>
<para>
This function verifies a CMS signature, either attached or detached, with the specified encoding.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>input_filename</parameter></term>
<listitem>
<para>
The input file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
Flags to pass to <function>cms_verify</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>certificates</parameter></term>
<listitem>
<para>
A file with the signer certificate and optionally intermediate certificates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ca_info</parameter></term>
<listitem>
<para>
An array containing self-signed certificate authority certificates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>untrusted_certificates_filename</parameter></term>
<listitem>
<para>
A file containing additional intermediate certificates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>content</parameter></term>
<listitem>
<para>
A file pointing to the content when signatures are detached.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pk7</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>sigfile</parameter></term>
<listitem>
<para>
A file to save the signature to.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
<para>
The encoding of the input file. One of <constant>OPENSSL_CMS_SMIME</constant>,
<constant>OPENSLL_CMS_DER</constant> or <constant>OPENSSL_CMS_PEM</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</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
-->