1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimX509_check_ca - check if given certificate is CA certificate 6e71b7053SJung-uk Kim 7e71b7053SJung-uk Kim=head1 SYNOPSIS 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim #include <openssl/x509v3.h> 10e71b7053SJung-uk Kim 11e71b7053SJung-uk Kim int X509_check_ca(X509 *cert); 12e71b7053SJung-uk Kim 13e71b7053SJung-uk Kim=head1 DESCRIPTION 14e71b7053SJung-uk Kim 15e71b7053SJung-uk KimThis function checks if given certificate is CA certificate (can be used 16*b077aed3SPierre Proncheryto sign other certificates). The certificate must be a complete certificate 17*b077aed3SPierre Proncheryotherwise an error is returned. 18e71b7053SJung-uk Kim 19e71b7053SJung-uk Kim=head1 RETURN VALUES 20e71b7053SJung-uk Kim 21e71b7053SJung-uk KimFunction return 0, if it is not CA certificate, 1 if it is proper X509v3 22e71b7053SJung-uk KimCA certificate with B<basicConstraints> extension CA:TRUE, 23e71b7053SJung-uk Kim3, if it is self-signed X509 v1 certificate, 4, if it is certificate with 24e71b7053SJung-uk KimB<keyUsage> extension with bit B<keyCertSign> set, but without 25e71b7053SJung-uk KimB<basicConstraints>, and 5 if it has outdated Netscape Certificate Type 26e71b7053SJung-uk Kimextension telling that it is CA certificate. 27e71b7053SJung-uk Kim 28*b077aed3SPierre ProncheryThis function will also return 0 on error. 29*b077aed3SPierre Pronchery 3058f35182SJung-uk KimActually, any nonzero value means that this certificate could have been 31e71b7053SJung-uk Kimused to sign other certificates. 32e71b7053SJung-uk Kim 33e71b7053SJung-uk Kim=head1 SEE ALSO 34e71b7053SJung-uk Kim 35e71b7053SJung-uk KimL<X509_verify_cert(3)>, 36e71b7053SJung-uk KimL<X509_check_issued(3)>, 37e71b7053SJung-uk KimL<X509_check_purpose(3)> 38e71b7053SJung-uk Kim 39e71b7053SJung-uk Kim=head1 COPYRIGHT 40e71b7053SJung-uk Kim 41*b077aed3SPierre ProncheryCopyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. 42e71b7053SJung-uk Kim 43*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 44e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 45e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 46e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 47e71b7053SJung-uk Kim 48e71b7053SJung-uk Kim=cut 49