1X509_CMP(3)                         OpenSSL                        X509_CMP(3)
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.
34       i2d_X509_NAME(3) has a more detailed description of the DER encoding of
35       the X509_NAME structure.
36
37       The X509_issuer_and_serial_cmp() function compares the serial number
38       and issuer values in the given X509 objects a and b.
39
40       The X509_issuer_name_cmp(), X509_subject_name_cmp() and X509_CRL_cmp()
41       functions are effectively wrappers of the X509_NAME_cmp() function.
42       These functions compare issuer names and subject names of the  objects,
43       or issuers of X509_CRL objects, respectively.
44
45       The X509_CRL_match() function compares two X509_CRL objects. Unlike the
46       X509_CRL_cmp() function, this function compares the whole CRL content
47       instead of just the issuer name.
48

RETURN VALUES

50       Like common memory comparison functions, the X509 comparison functions
51       return an integer less than, equal to, or greater than zero if object a
52       is found to be less than, to match, or be greater than object b,
53       respectively.
54
55       X509_NAME_cmp(), X509_issuer_and_serial_cmp(), X509_issuer_name_cmp(),
56       X509_subject_name_cmp() and X509_CRL_cmp() may return -2 to indicate an
57       error.
58

NOTES

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

SEE ALSO

70       i2d_X509_NAME(3), i2d_X509(3)
71
73       Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
74
75       Licensed under the Apache License 2.0 (the "License").  You may not use
76       this file except in compliance with the License.  You can obtain a copy
77       in the file LICENSE in the source distribution or at
78       <https://www.openssl.org/source/license.html>.
79
80
81
821.1.1d                            2019-10-03                       X509_CMP(3)
Impressum