X509_verify.3ossl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "X509_VERIFY 3ossl"
  58. .TH X509_VERIFY 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. X509_verify, X509_self_signed,
  65. X509_REQ_verify_ex, X509_REQ_verify,
  66. X509_CRL_verify, X509_ACERT_verify \-
  67. verify certificate, certificate request, or CRL signature
  68. .SH SYNOPSIS
  69. .IX Header "SYNOPSIS"
  70. .Vb 1
  71. \& #include <openssl/x509.h>
  72. \&
  73. \& int X509_verify(X509 *x, EVP_PKEY *pkey);
  74. \& int X509_self_signed(X509 *cert, int verify_signature);
  75. \&
  76. \& int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
  77. \& const char *propq);
  78. \& int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
  79. \& int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
  80. \&
  81. \& #include <openssl/x509_acert.h>
  82. \& int X509_ACERT_verify(X509_CRL *a, EVP_PKEY *r);
  83. .Ve
  84. .SH DESCRIPTION
  85. .IX Header "DESCRIPTION"
  86. \&\fBX509_verify()\fR verifies the signature of certificate \fIx\fR using public key
  87. \&\fIpkey\fR. Only the signature is checked: no other checks (such as certificate
  88. chain validity) are performed.
  89. .PP
  90. \&\fBX509_self_signed()\fR checks whether certificate \fIcert\fR is self-signed.
  91. For success the issuer and subject names must match, the components of the
  92. authority key identifier (if present) must match the subject key identifier etc.
  93. The signature itself is actually verified only if \fBverify_signature\fR is 1, as
  94. for explicitly trusted certificates this verification is not worth the effort.
  95. .PP
  96. \&\fBX509_REQ_verify_ex()\fR, \fBX509_REQ_verify()\fR, \fBX509_CRL_verify()\fR and \fBX509_ACERT_verify()\fR
  97. verify the signatures of certificate requests, CRLs and attribute certificates
  98. respectively.
  99. .SH "RETURN VALUES"
  100. .IX Header "RETURN VALUES"
  101. \&\fBX509_verify()\fR,
  102. \&\fBX509_REQ_verify_ex()\fR, \fBX509_REQ_verify()\fR and \fBX509_CRL_verify()\fR
  103. return 1 if the signature is valid and 0 if the signature check fails.
  104. If the signature could not be checked at all because it was ill-formed,
  105. the certificate or the request was not complete or some other error occurred
  106. then \-1 is returned.
  107. .PP
  108. \&\fBX509_self_signed()\fR returns the same values but also returns 1
  109. if all respective fields match and \fBverify_signature\fR is 0.
  110. .SH "SEE ALSO"
  111. .IX Header "SEE ALSO"
  112. \&\fBd2i_X509\fR\|(3),
  113. \&\fBERR_get_error\fR\|(3),
  114. \&\fBX509_CRL_get0_by_serial\fR\|(3),
  115. \&\fBX509_get0_signature\fR\|(3),
  116. \&\fBX509_get_ext_d2i\fR\|(3),
  117. \&\fBX509_get_extension_flags\fR\|(3),
  118. \&\fBX509_get_pubkey\fR\|(3),
  119. \&\fBX509_get_subject_name\fR\|(3),
  120. \&\fBX509_get_version\fR\|(3),
  121. \&\fBX509_NAME_ENTRY_get_object\fR\|(3),
  122. \&\fBX509_NAME_get_index_by_NID\fR\|(3),
  123. \&\fBX509_NAME_print_ex\fR\|(3),
  124. \&\fBX509V3_get_d2i\fR\|(3),
  125. \&\fBX509_verify_cert\fR\|(3),
  126. \&\fBOSSL_LIB_CTX\fR\|(3)
  127. .SH HISTORY
  128. .IX Header "HISTORY"
  129. The \fBX509_verify()\fR, \fBX509_REQ_verify()\fR, and \fBX509_CRL_verify()\fR
  130. functions are available in all versions of OpenSSL.
  131. .PP
  132. \&\fBX509_REQ_verify_ex()\fR, and \fBX509_self_signed()\fR were added in OpenSSL 3.0.
  133. .PP
  134. \&\fBX509_ACERT_verify()\fR was added in OpenSSL 3.4.
  135. .SH COPYRIGHT
  136. .IX Header "COPYRIGHT"
  137. Copyright 2015\-2024 The OpenSSL Project Authors. All Rights Reserved.
  138. .PP
  139. Licensed under the Apache License 2.0 (the "License"). You may not use
  140. this file except in compliance with the License. You can obtain a copy
  141. in the file LICENSE in the source distribution or at
  142. <https://www.openssl.org/source/license.html>.