SMIME_read_CMS.3ossl 4.7 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 "SMIME_READ_CMS 3ossl"
  58. .TH SMIME_READ_CMS 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. SMIME_read_CMS_ex, SMIME_read_CMS \- parse S/MIME message
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. .Vb 1
  68. \& #include <openssl/cms.h>
  69. \&
  70. \& CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont,
  71. \& CMS_ContentInfo **cms);
  72. \& CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);
  73. .Ve
  74. .SH DESCRIPTION
  75. .IX Header "DESCRIPTION"
  76. \&\fBSMIME_read_CMS()\fR parses a message in S/MIME format.
  77. .PP
  78. \&\fBin\fR is a BIO to read the message from.
  79. .PP
  80. If cleartext signing is used then the content is saved in a memory bio which is
  81. written to \fB*bcont\fR, otherwise \fB*bcont\fR is set to NULL.
  82. .PP
  83. The parsed CMS_ContentInfo structure is returned or NULL if an
  84. error occurred.
  85. .PP
  86. \&\fBSMIME_read_CMS_ex()\fR is similar to \fBSMIME_read_CMS()\fR but optionally a previously
  87. created \fIcms\fR CMS_ContentInfo object can be supplied as well as some \fIflags\fR.
  88. To create a \fIcms\fR object use \fBCMS_ContentInfo_new_ex\fR\|(3).
  89. If the \fIflags\fR argument contains \fBCMS_BINARY\fR then the input is assumed to be
  90. in binary format and is not translated to canonical form.
  91. If in addition \fBSMIME_ASCIICRLF\fR is set then the binary input is assumed
  92. to be followed by \fBCR\fR and \fBLF\fR characters, else only by an \fBLF\fR character.
  93. If \fIflags\fR is 0 and \fIcms\fR is NULL then it is identical to \fBSMIME_read_CMS()\fR.
  94. .SH NOTES
  95. .IX Header "NOTES"
  96. If \fB*bcont\fR is not NULL then the message is clear text signed. \fB*bcont\fR can
  97. then be passed to \fBCMS_verify()\fR with the \fBCMS_DETACHED\fR flag set.
  98. .PP
  99. Otherwise the type of the returned structure can be determined
  100. using \fBCMS_get0_type()\fR.
  101. .PP
  102. To support future functionality if \fBbcont\fR is not NULL \fB*bcont\fR should be
  103. initialized to NULL. For example:
  104. .PP
  105. .Vb 2
  106. \& BIO *cont = NULL;
  107. \& CMS_ContentInfo *cms;
  108. \&
  109. \& cms = SMIME_read_CMS(in, &cont);
  110. .Ve
  111. .SH BUGS
  112. .IX Header "BUGS"
  113. The MIME parser used by \fBSMIME_read_CMS()\fR is somewhat primitive. While it will
  114. handle most S/MIME messages more complex compound formats may not work.
  115. .PP
  116. The parser assumes that the CMS_ContentInfo structure is always base64 encoded
  117. and will not handle the case where it is in binary format or uses quoted
  118. printable format.
  119. .PP
  120. The use of a memory BIO to hold the signed content limits the size of message
  121. which can be processed due to memory restraints: a streaming single pass option
  122. should be available.
  123. .SH "RETURN VALUES"
  124. .IX Header "RETURN VALUES"
  125. \&\fBSMIME_read_CMS_ex()\fR and \fBSMIME_read_CMS()\fR return a valid \fBCMS_ContentInfo\fR
  126. structure or \fBNULL\fR if an error occurred. The error can be obtained from
  127. \&\fBERR_get_error\fR\|(3).
  128. .SH "SEE ALSO"
  129. .IX Header "SEE ALSO"
  130. \&\fBERR_get_error\fR\|(3),
  131. \&\fBCMS_sign\fR\|(3),
  132. \&\fBCMS_verify\fR\|(3),
  133. \&\fBCMS_encrypt\fR\|(3),
  134. \&\fBCMS_decrypt\fR\|(3)
  135. .SH HISTORY
  136. .IX Header "HISTORY"
  137. The function \fBSMIME_read_CMS_ex()\fR was added in OpenSSL 3.0.
  138. .SH COPYRIGHT
  139. .IX Header "COPYRIGHT"
  140. Copyright 2008\-2021 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>.