An X.509 certificate in PEM format (its content).
Indicates whether the key usage of the certificate allows it to sign data: the key usage extension, when the certificate has one, must allow "digitalSignature" or "nonRepudiation". A certificate without this extension is not restricted.
Whether the key usage of the certificate, if it has one, allows it to sign CRLs.
The DER encoding of the certificate.
Gets the Distinguished Name of the subject of the certificate, in the
OpenSSL "oneline" format, as the PHP library gives it: every field, in
the order of the certificate, written /<short name>=<value>, the
fields of one RDN joined by +, with / and + escaped by a backslash
and every byte out of printable ASCII written \xHH.
An extension, by its OID: its criticality and its value (the content of its OCTET STRING), or null.
Whether the extension is critical.
The DER of its value, the content of its OCTET STRING.
Gets the fingerprint of the certificate: the hash of its DER encoding. Two certificates are the same certificate if, and only if, their fingerprints are equal.
The hash algorithm. Default: 'sha256'.
The fingerprint, as a lowercase hexadecimal string.
Gets the fields of the issuer of the certificate.
Gets the certificate in PEM format.
The public key of the certificate.
The DER encoding of the issuer name, as a CRL names its issuer.
The DER encoding of the subject name.
The serial number, as unsigned big-endian bytes.
Gets the fields of the subject of the certificate.
Gets the date from which the certificate is valid, in UTC
(YYYY-MM-DDThh:mm:ssZ).
Gets the date until which the certificate is valid, in UTC
(YYYY-MM-DDThh:mm:ssZ).
Whether the certificate is a CA by its basic constraints.
Indicates whether the certificate is out of date at the current date.
Checks that the certificate is trusted: its chain is built and verified
up to a self-signed certificate of the given CA certificates, with the
rules OpenSSL applies for the PHP library (openssl_x509_checkpurpose(),
purpose "any").
Every given certificate is trusted, and the chain is built from these
certificates only (and the untrusted ones), never from those of the
system. A certificate is
taken as the issuer of another one when its subject is the issuer of the
other one (names compared in the canonical form of OpenSSL), when the
authority key identifier of the other one matches it, and when its key
suits the signature algorithm of the other one. Then:
at);A chain that stops at an intermediate CA is rejected: to trust the certificates issued by an intermediate CA, give its certificate and the certificates up to its root. A certificate issued by another intermediate CA of the same root is then rejected, since the chain cannot be built without that other intermediate certificate.
Name constraints are not enforced: a CA certificate that has them is rejected, where OpenSSL would enforce them.
The CA certificates: paths of PEM files, or PEM contents, each of which may hold several certificates.
untrusted: certificates the chain may be built with,
after the CA certificates, without being trusted (the intermediate
CAs a signature embeds): the root must still be one of the CA
certificates. at: the date the certificates must be valid at,
instead of the current date.
True if the chain of the certificate has been verified.
Checks the origin of the certificate: it was issued by the given CA certificate. The CA certificate must be a CA ("CA:TRUE" basic constraint and, if it has a key usage, "keyCertSign"), the issuer of the certificate must have the fields of the subject of the CA certificate, and OpenSSL must verify the signature of the certificate with the key of the CA certificate.
Only this link is checked: neither the validity dates nor the chain of
the CA certificate. Use isTrustedBy() to verify the whole chain.
The CA certificate, in PEM format (its content).
StaticderConverts a DER encoded X.509 certificate to its PEM encoding, with lines of 64 base64 characters (RFC 7468, as OpenSSL writes them).
DER encoded X.509 certificate.
The PEM encoded certificate, or null if the parameter is not bytes.
StaticpemConverts a PEM encoded X.509 certificate to its DER encoding: the
base64 content of its first CERTIFICATE block, decoded. Characters
out of the base64 alphabet are ignored, as by the PHP library.
PEM encoded X.509 certificate.
The DER encoded certificate, or null if the parameter is not a
string or holds no -----BEGIN CERTIFICATE----- line.
Analyzes an X.509 certificate: the counterpart of the class
X509Certof the PHP library.It extracts the information of the certificate (subject, issuer, validity dates, fingerprint) and makes the checks the analysis of a token needs: the validity at the current date, the key usage, and the chain of the certificate up to trusted CA certificates (
isTrustedBy()), which follows the rules OpenSSL applies for the PHP library. The certificate is parsed by OpenSSL (node:crypto), which also verifies the signature of each link of a chain; the fields node:crypto does not expose are read from the DER encoding of the certificate.