X509_check_purpose.pod 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. =pod
  2. =head1 NAME
  3. X509_check_purpose - Check the purpose of a certificate
  4. =head1 SYNOPSIS
  5. #include <openssl/x509v3.h>
  6. int X509_check_purpose(X509 *x, int id, int ca);
  7. =head1 DESCRIPTION
  8. This function checks if certificate I<x> was created with the purpose
  9. represented by I<id>. If I<ca> is nonzero, then certificate I<x> is
  10. checked to determine if it's a possible CA with various levels of certainty
  11. possibly returned.
  12. Below are the potential ID's that can be checked:
  13. # define X509_PURPOSE_SSL_CLIENT 1
  14. # define X509_PURPOSE_SSL_SERVER 2
  15. # define X509_PURPOSE_NS_SSL_SERVER 3
  16. # define X509_PURPOSE_SMIME_SIGN 4
  17. # define X509_PURPOSE_SMIME_ENCRYPT 5
  18. # define X509_PURPOSE_CRL_SIGN 6
  19. # define X509_PURPOSE_ANY 7
  20. # define X509_PURPOSE_OCSP_HELPER 8
  21. # define X509_PURPOSE_TIMESTAMP_SIGN 9
  22. =head1 RETURN VALUES
  23. For non-CA checks
  24. =over 4
  25. =item -1 an error condition has occurred
  26. =item E<32>1 if the certificate was created to perform the purpose represented by I<id>
  27. =item E<32>0 if the certificate was not created to perform the purpose represented by I<id>
  28. =back
  29. For CA checks the below integers could be returned with the following meanings:
  30. =over 4
  31. =item -1 an error condition has occurred
  32. =item E<32>0 not a CA or does not have the purpose represented by I<id>
  33. =item E<32>1 is a CA.
  34. =item E<32>2 Only possible in old versions of openSSL when basicConstraints are absent.
  35. New versions will not return this value. May be a CA
  36. =item E<32>3 basicConstraints absent but self signed V1.
  37. =item E<32>4 basicConstraints absent but keyUsage present and keyCertSign asserted.
  38. =item E<32>5 legacy Netscape specific CA Flags present
  39. =back
  40. =head1 COPYRIGHT
  41. Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  42. Licensed under the Apache License 2.0 (the "License"). You may not use this
  43. file except in compliance with the License. You can obtain a copy in the file
  44. LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>.
  45. =cut