1X509_CMP(3ossl)                     OpenSSL                    X509_CMP(3ossl)
2
3
4

NAME

6       X509_cmp, X509_NAME_cmp, X509_issuer_and_serial_cmp,
7       X509_issuer_name_cmp, X509_subject_name_cmp, X509_CRL_cmp,
8       X509_CRL_match - compare X509 certificates and related values
9

SYNOPSIS

11        #include <openssl/x509.h>
12
13        int X509_cmp(const X509 *a, const X509 *b);
14        int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
15        int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
16        int X509_issuer_name_cmp(const X509 *a, const X509 *b);
17        int X509_subject_name_cmp(const X509 *a, const X509 *b);
18        int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
19        int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
20

DESCRIPTION

22       This set of functions are used to compare X509 objects, including X509
23       certificates, X509 CRL objects and various values in an X509
24       certificate.
25
26       The X509_cmp() function compares two X509 objects indicated by
27       parameters a and b. The comparison is based on the memcmp result of the
28       hash values of two X509 objects and the canonical (DER) encoding
29       values.
30
31       The X509_NAME_cmp() function compares two X509_NAME objects indicated
32       by parameters a and b. The comparison is based on the memcmp result of
33       the canonical (DER) encoding values of the two objects using
34       i2d_X509_NAME(3).  This procedure adheres to the matching rules for
35       Distinguished Names (DN) given in RFC 4517 section 4.2.15 and RFC 5280
36       section 7.1.  In particular, the order of Relative Distinguished Names
37       (RDNs) is relevant.  On the other hand, if an RDN is multi-valued,
38       i.e., it contains a set of AttributeValueAssertions (AVAs), its members
39       are effectively not ordered.
40
41       The X509_issuer_and_serial_cmp() function compares the serial number
42       and issuer values in the given X509 objects a and b.
43
44       The X509_issuer_name_cmp(), X509_subject_name_cmp() and X509_CRL_cmp()
45       functions are effectively wrappers of the X509_NAME_cmp() function.
46       These functions compare issuer names and subject names of the  objects,
47       or issuers of X509_CRL objects, respectively.
48
49       The X509_CRL_match() function compares two X509_CRL objects. Unlike the
50       X509_CRL_cmp() function, this function compares the whole CRL content
51       instead of just the issuer name.
52

RETURN VALUES

54       The X509 comparison functions return -1, 0, or 1 if object a is found
55       to be less than, to match, or be greater than object b, respectively.
56
57       X509_NAME_cmp(), X509_issuer_and_serial_cmp(), X509_issuer_name_cmp(),
58       X509_subject_name_cmp(), X509_CRL_cmp(), and X509_CRL_match() may
59       return -2 to indicate an error.
60

NOTES

62       These functions in fact utilize the underlying memcmp of the C library
63       to do the comparison job. Data to be compared varies from DER encoding
64       data, hash value or ASN1_STRING. The sign of the comparison can be used
65       to order the objects but it does not have a special meaning in some
66       cases.
67
68       X509_NAME_cmp() and wrappers utilize the value -2 to indicate errors in
69       some circumstances, which could cause confusion for the applications.
70

SEE ALSO

72       i2d_X509_NAME(3), i2d_X509(3)
73
75       Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
76
77       Licensed under the Apache License 2.0 (the "License").  You may not use
78       this file except in compliance with the License.  You can obtain a copy
79       in the file LICENSE in the source distribution or at
80       <https://www.openssl.org/source/license.html>.
81
82
83
843.1.1                             2023-08-31                   X509_CMP(3ossl)
Impressum