X509_get_subject_name.3ossl 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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_SUBJECT_NAME 3ossl"
  58. .TH X509_GET_SUBJECT_NAME 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_NAME_hash_ex, X509_NAME_hash,
  65. X509_get_subject_name, X509_set_subject_name, X509_subject_name_hash,
  66. X509_get_issuer_name, X509_set_issuer_name, X509_issuer_name_hash,
  67. X509_REQ_get_subject_name, X509_REQ_set_subject_name,
  68. X509_ACERT_get0_issuerName, X509_ACERT_set1_issuerName,
  69. X509_CRL_get_issuer, X509_CRL_set_issuer_name \-
  70. get X509_NAME hashes or get and set issuer or subject names
  71. .SH SYNOPSIS
  72. .IX Header "SYNOPSIS"
  73. .Vb 1
  74. \& #include <openssl/x509.h>
  75. \&
  76. \& unsigned long X509_NAME_hash_ex(const X509_NAME *x, OSSL_LIB_CTX *libctx,
  77. \& const char *propq, int *ok);
  78. \&
  79. \& X509_NAME *X509_get_subject_name(const X509 *x);
  80. \& int X509_set_subject_name(X509 *x, const X509_NAME *name);
  81. \& unsigned long X509_subject_name_hash(X509 *x);
  82. \&
  83. \& X509_NAME *X509_get_issuer_name(const X509 *x);
  84. \& int X509_set_issuer_name(X509 *x, const X509_NAME *name);
  85. \& unsigned long X509_issuer_name_hash(X509 *x);
  86. \&
  87. \& X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req);
  88. \& int X509_REQ_set_subject_name(X509_REQ *req, const X509_NAME *name);
  89. \&
  90. \& X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl);
  91. \& int X509_CRL_set_issuer_name(X509_CRL *x, const X509_NAME *name);
  92. \&
  93. \& #include <openssl/x509_acert.h>
  94. \&
  95. \& X509_NAME *X509_ACERT_get0_issuerName(const X509_ACERT *x);
  96. \& int X509_ACERT_set1_issuerName(X509_ACERT *x, const X509_NAME *name);
  97. .Ve
  98. .PP
  99. The following macro has been deprecated since OpenSSL 3.0, and can be
  100. hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
  101. see \fBopenssl_user_macros\fR\|(7):
  102. .PP
  103. .Vb 1
  104. \& #define X509_NAME_hash(x) X509_NAME_hash_ex(x, NULL, NULL, NULL)
  105. .Ve
  106. .SH DESCRIPTION
  107. .IX Header "DESCRIPTION"
  108. \&\fBX509_NAME_hash_ex()\fR returns a hash value of name \fIx\fR or 0 on failure,
  109. using any given library context \fIlibctx\fR and property query \fIpropq\fR.
  110. The \fIok\fR result argument may be NULL
  111. or else is used to return 1 for success and 0 for failure.
  112. Failure may happen on malloc error or if no SHA1 implementation is available.
  113. .PP
  114. \&\fBX509_NAME_hash()\fR returns a hash value of name \fIx\fR or 0 on failure,
  115. using the default library context and default property query.
  116. .PP
  117. \&\fBX509_get_subject_name()\fR returns the subject name of certificate \fIx\fR. The
  118. returned value is an internal pointer which \fBMUST NOT\fR be freed.
  119. .PP
  120. \&\fBX509_set_subject_name()\fR sets the issuer name of certificate \fIx\fR to
  121. \&\fIname\fR. The \fIname\fR parameter is copied internally and should be freed
  122. up when it is no longer needed.
  123. .PP
  124. \&\fBX509_subject_name_hash()\fR returns a hash value of the subject name of
  125. certificate \fIx\fR.
  126. .PP
  127. \&\fBX509_get_issuer_name()\fR, \fBX509_set_issuer_name()\fR, and \fBX509_issuer_name_hash()\fR
  128. are identical to
  129. \&\fBX509_get_subject_name()\fR, \fBX509_set_subject_name()\fR, and \fBX509_subject_name_hash()\fR
  130. except they relate to the issuer name of \fIx\fR.
  131. .PP
  132. Similarly \fBX509_REQ_get_subject_name()\fR, \fBX509_REQ_set_subject_name()\fR,
  133. \&\fBX509_ACERT_get0_issuerName()\fR, \fBX509_ACERT_set1_issuerName()\fR,
  134. \&\fBX509_CRL_get_issuer()\fR and \fBX509_CRL_set_issuer_name()\fR get or set the subject
  135. or issuer names of certificate requests of CRLs respectively.
  136. .PP
  137. Since attribute certificates do not have a subject name, only the issuer name
  138. can be set. For details on setting X509_ACERT holder identities, see
  139. \&\fBX509_ACERT_set0_holder_entityName\fR\|(3).
  140. .SH "RETURN VALUES"
  141. .IX Header "RETURN VALUES"
  142. \&\fBX509_get_subject_name()\fR, \fBX509_get_issuer_name()\fR, \fBX509_REQ_get_subject_name()\fR
  143. \&\fBX509_ACERT_get0_issuerName()\fR and \fBX509_CRL_get_issuer()\fR return
  144. an \fBX509_NAME\fR pointer.
  145. .PP
  146. \&\fBX509_NAME_hash_ex()\fR, \fBX509_NAME_hash()\fR,
  147. \&\fBX509_subject_name_hash()\fR and \fBX509_issuer_name_hash()\fR
  148. return the first four bytes of the SHA1 hash value,
  149. converted to \fBunsigned long\fR in little endian order,
  150. or 0 on failure.
  151. .PP
  152. \&\fBX509_set_subject_name()\fR, \fBX509_set_issuer_name()\fR, \fBX509_REQ_set_subject_name()\fR,
  153. \&\fBX509_ACERT_get0_issuerName()\fR and \fBX509_CRL_set_issuer_name()\fR return 1 for
  154. success and 0 for failure.
  155. .SH BUGS
  156. .IX Header "BUGS"
  157. In case \fBX509_NAME_hash()\fR, \fBX509_subject_name_hash()\fR, or \fBX509_issuer_name_hash()\fR
  158. returns 0 it remains unclear if this is the real hash value or due to failure.
  159. Better use \fBX509_NAME_hash_ex()\fR instead.
  160. .SH "SEE ALSO"
  161. .IX Header "SEE ALSO"
  162. \&\fBd2i_X509\fR\|(3),
  163. \&\fBERR_get_error\fR\|(3), \fBd2i_X509\fR\|(3)
  164. \&\fBX509_CRL_get0_by_serial\fR\|(3),
  165. \&\fBX509_get0_signature\fR\|(3),
  166. \&\fBX509_get_ext_d2i\fR\|(3),
  167. \&\fBX509_get_extension_flags\fR\|(3),
  168. \&\fBX509_get_pubkey\fR\|(3),
  169. \&\fBX509_NAME_add_entry_by_txt\fR\|(3),
  170. \&\fBX509_NAME_ENTRY_get_object\fR\|(3),
  171. \&\fBX509_NAME_get_index_by_NID\fR\|(3),
  172. \&\fBX509_NAME_print_ex\fR\|(3),
  173. \&\fBX509_new\fR\|(3),
  174. \&\fBX509_sign\fR\|(3),
  175. \&\fBX509V3_get_d2i\fR\|(3),
  176. \&\fBX509_verify_cert\fR\|(3)
  177. .SH HISTORY
  178. .IX Header "HISTORY"
  179. \&\fBX509_REQ_get_subject_name()\fR is a function in OpenSSL 1.1.0 and a macro in
  180. earlier versions.
  181. .PP
  182. \&\fBX509_CRL_get_issuer()\fR is a function in OpenSSL 1.1.0. It was previously
  183. added in OpenSSL 1.0.0 as a macro.
  184. .PP
  185. \&\fBX509_NAME_hash()\fR was turned into a macro and deprecated in OpenSSL 3.0.
  186. .SH COPYRIGHT
  187. .IX Header "COPYRIGHT"
  188. Copyright 2015\-2024 The OpenSSL Project Authors. All Rights Reserved.
  189. .PP
  190. Licensed under the Apache License 2.0 (the "License"). You may not use
  191. this file except in compliance with the License. You can obtain a copy
  192. in the file LICENSE in the source distribution or at
  193. <https://www.openssl.org/source/license.html>.