[doc-en] master: Add more details about the array returned from openssl_x509_parse (php#2666) (#6013)

From: Date: Thu, 29 Oct 2026 10:56:30 +0000
Subject: [doc-en] master: Add more details about the array returned from openssl_x509_parse (php#2666) (#6013)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23897@lists.php.net to get a copy of this message
Author: vera-ju (vera-ju) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-10-29T11:56:26+01:00 Commit: https://github.com/php/doc-en/commit/2ad26fb7916c8ffb5264c07b30610ef4553e4cbf Raw diff: https://github.com/php/doc-en/commit/2ad26fb7916c8ffb5264c07b30610ef4553e4cbf.diff Add more details about the array returned from openssl_x509_parse (php#2666) (#6013) * Add more details about the array returned from openssl_x509_parse (php#2666) * Add more details about the array returned from openssl_x509_parse (php#2666) * Update reference/openssl/functions/openssl-x509-parse.xml Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> * Update reference/openssl/functions/openssl-x509-parse.xml Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> * Update reference/openssl/functions/openssl-x509-parse.xml Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> * Update reference/openssl/functions/openssl-x509-parse.xml Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> --------- Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> Changed paths: M reference/openssl/functions/openssl-x509-parse.xml Diff: diff --git a/reference/openssl/functions/openssl-x509-parse.xml b/reference/openssl/functions/openssl-x509-parse.xml index 1b303ccdfb72..3a6d287f9ced 100644 --- a/reference/openssl/functions/openssl-x509-parse.xml +++ b/reference/openssl/functions/openssl-x509-parse.xml @@ -49,9 +49,215 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; + <simpara> + Returns an &array; of certificate fields on success, or &false; on failure. + </simpara> + <simpara> + <literal>alias</literal> is present only when the certificate has an alias. + Every other key listed below is always present. + </simpara> <para> - <emphasis>The structure of the returned data is (deliberately) not - yet documented, as it is still subject to change.</emphasis> + <table> + <title>Array returned by <function>openssl_x509_parse</function></title> + <tgroup cols="3"> + <thead> + <row> + <entry>Key</entry> + <entry>Type</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>name</literal></entry> + <entry><type>string</type></entry> + <entry> + Subject distinguished name as a single string, with components separated by slashes. + For example, <literal>/C=US/O=Example/CN=example.com</literal>. + </entry> + </row> + <row> + <entry><literal>subject</literal></entry> + <entry><type>array</type></entry> + <entry> + Subject distinguished name. Keys are short names such as + <literal>CN</literal> when <parameter>short_names</parameter> is + &true;, and long names such as <literal>commonName</literal> + otherwise. Each value is a UTF-8 &string;, or an &array; of UTF-8 + &string;s when that component occurs more than once. + </entry> + </row> + <row> + <entry><literal>hash</literal></entry> + <entry><type>string</type></entry> + <entry> + Lowercase hexadecimal hash of the subject name, as used to look up + a certificate in an OpenSSL CA directory. This is an 8-digit value. + It is not the certificate fingerprint; see + <function>openssl_x509_fingerprint</function>. + </entry> + </row> + <row> + <entry><literal>issuer</literal></entry> + <entry><type>array</type></entry> + <entry> + Issuer distinguished name, in the same form as + <literal>subject</literal>. + </entry> + </row> + <row> + <entry><literal>version</literal></entry> + <entry><type>int</type></entry> + <entry> + Raw version field stored in the certificate. This value is one less + than the certificate version usually displayed: a version 1 + certificate is <literal>0</literal>, a version 2 certificate is + <literal>1</literal>, and a version 3 certificate is + <literal>2</literal>. + </entry> + </row> + <row> + <entry><literal>serialNumber</literal></entry> + <entry><type>string</type></entry> + <entry> + Decimal representation of the serial number. Large serial numbers are + returned as a hexadecimal string prefixed with <literal>0x</literal> instead. + </entry> + </row> + <row> + <entry><literal>serialNumberHex</literal></entry> + <entry><type>string</type></entry> + <entry> + Uppercase hexadecimal representation of the serial number. + </entry> + </row> + <row> + <entry><literal>validFrom</literal></entry> + <entry><type>string</type></entry> + <entry> + Not-before time in ASN.1 form, either UTCTime + (<literal>YYMMDDHHMMSSZ</literal>) or GeneralizedTime + (<literal>YYYYMMDDHHMMSSZ</literal>). + </entry> + </row> + <row> + <entry><literal>validTo</literal></entry> + <entry><type>string</type></entry> + <entry> + Not-after time, in the same form as <literal>validFrom</literal>. + </entry> + </row> + <row> + <entry><literal>validFrom_time_t</literal></entry> + <entry><type>int</type></entry> + <entry> + Not-before time as a Unix timestamp, or <literal>-1</literal> if the + time could not be parsed. + </entry> + </row> + <row> + <entry><literal>validTo_time_t</literal></entry> + <entry><type>int</type></entry> + <entry> + Not-after time as a Unix timestamp, or <literal>-1</literal> if the + time could not be parsed. + </entry> + </row> + <row> + <entry><literal>alias</literal></entry> + <entry><type>string</type></entry> + <entry> + Certificate alias (friendly name). Only present when one is set. + </entry> + </row> + <row> + <entry><literal>signatureTypeSN</literal></entry> + <entry><type>string</type></entry> + <entry> + Short name of the signature algorithm. + </entry> + </row> + <row> + <entry><literal>signatureTypeLN</literal></entry> + <entry><type>string</type></entry> + <entry> + Long name of the signature algorithm. + </entry> + </row> + <row> + <entry><literal>signatureTypeNID</literal></entry> + <entry><type>int</type></entry> + <entry> + Numeric signature-algorithm identifier (OpenSSL NID). + </entry> + </row> + <row> + <entry><literal>purposes</literal></entry> + <entry><type>array</type></entry> + <entry> + Purpose checks, indexed by purpose id. The ids are the + <link linkend="openssl.purpose-check"><constant>X509_PURPOSE_<replaceable>*</replaceable></constant></link> + constants. Each value is an &array; described below. + </entry> + </row> + <row> + <entry><literal>extensions</literal></entry> + <entry><type>array</type></entry> + <entry> + Certificate extensions, indexed by short name (for example + <literal>subjectAltName</literal>) or by OID when the extension has + no short name. Each value is text describing that extension, or the raw + extension data when it cannot be printed. Which keys are present depends on the certificate. + This array does not follow <parameter>short_names</parameter>. + </entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <simpara> + Each element of <literal>purposes</literal> has the following keys: + </simpara> + <para> + <table> + <title>Purpose entry</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Key</entry> + <entry>Type</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>0</literal></entry> + <entry><type>bool</type></entry> + <entry> + &true; if the certificate can be used for this purpose as an + end-entity certificate. + </entry> + </row> + <row> + <entry><literal>1</literal></entry> + <entry><type>bool</type></entry> + <entry> + &true; if the certificate can be used for this purpose as a CA + certificate. + </entry> + </row> + <row> + <entry><literal>2</literal></entry> + <entry><type>string</type></entry> + <entry> + Purpose name. A short name such as <literal>sslclient</literal> + when <parameter>short_names</parameter> is &true;, and a long name + such as <literal>SSL client</literal> otherwise. + </entry> + </row> + </tbody> + </tgroup> + </table> </para> </refsect1>

« previous php.doc.cvs (#23897) next »