libressl-X509_cmp3
Compare x.509 certificates and related values
Usage
Crypto Library
(libcrypto,
-lcrypto)
int
int
int
int
int
int
int
Overview
X509_cmp() compares two X.509 certificates using memcmp(3) on the hashes of their canonical (DER) representations as generated with X509_digest(3). The digest function is implementation-specific: LibreSSL uses SHA-512, other implementations use SHA-1.
X509_NAME_cmp() compares two X.501 Name objects using their canonical (DER) representations generated with i2d_X509_NAME(3).
X509_issuer_and_serial_cmp() compares the issuer and serialNumber fields of two TBSCertificate structures, using X509_NAME_cmp() for the issuer fields.
X509_issuer_name_cmp() compares the issuer fields of two TBSCertificate structures using X509_NAME_cmp().
X509_subject_name_cmp() compares the subject fields of two TBSCertificate structures using X509_NAME_cmp().
X509_CRL_cmp() is misnamed; it only compares the issuer fields of two TBSCertList structures using X509_NAME_cmp().
X509_CRL_match() compares two certificate revocation lists using memcmp(3) on the hashes of their canonical (DER) representations as generated with X509_CRL_digest(3). The digest function is implementation-specific: LibreSSL uses SHA-512, other implementations use SHA-1.
Return values
All these functions return 0 to indicate a match or a non-zero value to indicate a mismatch.
X509_NAME_cmp(), X509_issuer_and_serial_cmp(), X509_issuer_name_cmp(), X509_subject_name_cmp() and X509_CRL_cmp() may return -2 to indicate an error.