X509_get_version.3ossl 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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_GET_VERSION 3ossl"
  58. .TH X509_GET_VERSION 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_get_version, X509_set_version, X509_REQ_get_version, X509_REQ_set_version,
  65. X509_ACERT_get_version, X509_ACERT_set_version, X509_CRL_get_version,
  66. X509_CRL_set_version \- get or set certificate,
  67. certificate request or CRL version
  68. .SH SYNOPSIS
  69. .IX Header "SYNOPSIS"
  70. .Vb 1
  71. \& #include <openssl/x509.h>
  72. \&
  73. \& long X509_get_version(const X509 *x);
  74. \& int X509_set_version(X509 *x, long version);
  75. \&
  76. \& long X509_REQ_get_version(const X509_REQ *req);
  77. \& int X509_REQ_set_version(X509_REQ *x, long version);
  78. \&
  79. \& long X509_CRL_get_version(const X509_CRL *crl);
  80. \& int X509_CRL_set_version(X509_CRL *x, long version);
  81. \&
  82. \& #include <openssl/x509_acert.h>
  83. \&
  84. \& int X509_ACERT_set_version(X509_ACERT *x, long version);
  85. \& long X509_ACERT_get_version(const X509_ACERT *x);
  86. .Ve
  87. .SH DESCRIPTION
  88. .IX Header "DESCRIPTION"
  89. \&\fBX509_get_version()\fR returns the numerical value of the version field of
  90. certificate \fIx\fR. These correspond to the constants \fBX509_VERSION_1\fR,
  91. \&\fBX509_VERSION_2\fR, and \fBX509_VERSION_3\fR. Note: the values of these constants
  92. are defined by standards (X.509 et al) to be one less than the certificate
  93. version. So \fBX509_VERSION_3\fR has value 2 and \fBX509_VERSION_1\fR has value 0.
  94. .PP
  95. \&\fBX509_set_version()\fR sets the numerical value of the version field of certificate
  96. \&\fIx\fR to \fIversion\fR.
  97. .PP
  98. Similarly \fBX509_REQ_get_version()\fR, \fBX509_REQ_set_version()\fR,
  99. \&\fBX509_ACERT_get_version()\fR, \fBX509_ACERT_set_version()\fR,
  100. \&\fBX509_CRL_get_version()\fR and \fBX509_CRL_set_version()\fR get and set the version
  101. number of certificate requests and CRLs. They use constants
  102. \&\fBX509_REQ_VERSION_1\fR, \fBX509_ACERT_VERSION_2\fR, \fBX509_CRL_VERSION_1\fR,
  103. and \fBX509_CRL_VERSION_2\fR.
  104. .SH NOTES
  105. .IX Header "NOTES"
  106. The version field of certificates, certificate requests and CRLs has a
  107. DEFAULT value of \fBv1\|(0)\fR meaning the field should be omitted for version
  108. 1. This is handled transparently by these functions.
  109. .SH "RETURN VALUES"
  110. .IX Header "RETURN VALUES"
  111. \&\fBX509_get_version()\fR, \fBX509_REQ_get_version()\fR and \fBX509_CRL_get_version()\fR
  112. return the numerical value of the version field.
  113. .PP
  114. \&\fBX509_set_version()\fR, \fBX509_REQ_set_version()\fR and \fBX509_CRL_set_version()\fR
  115. return 1 for success and 0 for failure.
  116. .SH "SEE ALSO"
  117. .IX Header "SEE ALSO"
  118. \&\fBd2i_X509\fR\|(3),
  119. \&\fBERR_get_error\fR\|(3),
  120. \&\fBX509_CRL_get0_by_serial\fR\|(3),
  121. \&\fBX509_get0_signature\fR\|(3),
  122. \&\fBX509_get_ext_d2i\fR\|(3),
  123. \&\fBX509_get_extension_flags\fR\|(3),
  124. \&\fBX509_get_pubkey\fR\|(3),
  125. \&\fBX509_get_subject_name\fR\|(3),
  126. \&\fBX509_NAME_add_entry_by_txt\fR\|(3),
  127. \&\fBX509_NAME_ENTRY_get_object\fR\|(3),
  128. \&\fBX509_NAME_get_index_by_NID\fR\|(3),
  129. \&\fBX509_NAME_print_ex\fR\|(3),
  130. \&\fBX509_new\fR\|(3),
  131. \&\fBX509_sign\fR\|(3),
  132. \&\fBX509V3_get_d2i\fR\|(3),
  133. \&\fBX509_verify_cert\fR\|(3)
  134. .SH HISTORY
  135. .IX Header "HISTORY"
  136. \&\fBX509_get_version()\fR, \fBX509_REQ_get_version()\fR and \fBX509_CRL_get_version()\fR are
  137. functions in OpenSSL 1.1.0, in previous versions they were macros.
  138. .SH COPYRIGHT
  139. .IX Header "COPYRIGHT"
  140. Copyright 2015\-2024 The OpenSSL Project Authors. All Rights Reserved.
  141. .PP
  142. Licensed under the Apache License 2.0 (the "License"). You may not use
  143. this file except in compliance with the License. You can obtain a copy
  144. in the file LICENSE in the source distribution or at
  145. <https://www.openssl.org/source/license.html>.