CMS_add1_recipient_cert.3ossl 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 "CMS_ADD1_RECIPIENT_CERT 3ossl"
  58. .TH CMS_ADD1_RECIPIENT_CERT 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. CMS_add1_recipient, CMS_add1_recipient_cert, CMS_add0_recipient_key \- add recipients to a CMS enveloped data structure
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. .Vb 1
  68. \& #include <openssl/cms.h>
  69. \&
  70. \& CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,
  71. \& EVP_PKEY *originatorPrivKey,
  72. \& X509 *originator, unsigned int flags);
  73. \&
  74. \& CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
  75. \& X509 *recip, unsigned int flags);
  76. \&
  77. \& CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
  78. \& unsigned char *key, size_t keylen,
  79. \& unsigned char *id, size_t idlen,
  80. \& ASN1_GENERALIZEDTIME *date,
  81. \& ASN1_OBJECT *otherTypeId,
  82. \& ASN1_TYPE *otherType);
  83. .Ve
  84. .SH DESCRIPTION
  85. .IX Header "DESCRIPTION"
  86. \&\fBCMS_add1_recipient()\fR adds recipient \fBrecip\fR and provides the originator pkey
  87. \&\fBoriginatorPrivKey\fR and originator certificate \fBoriginator\fR to CMS_ContentInfo.
  88. The originator-related fields are relevant only in case when the keyAgreement
  89. method of providing of the shared key is in use.
  90. .PP
  91. \&\fBCMS_add1_recipient_cert()\fR adds recipient \fBrecip\fR to CMS_ContentInfo enveloped
  92. data structure \fBcms\fR as a KeyTransRecipientInfo structure.
  93. .PP
  94. \&\fBCMS_add0_recipient_key()\fR adds symmetric key \fBkey\fR of length \fBkeylen\fR using
  95. wrapping algorithm \fBnid\fR, identifier \fBid\fR of length \fBidlen\fR and optional
  96. values \fBdate\fR, \fBotherTypeId\fR and \fBotherType\fR to CMS_ContentInfo enveloped
  97. data structure \fBcms\fR as a KEKRecipientInfo structure.
  98. .PP
  99. The CMS_ContentInfo structure should be obtained from an initial call to
  100. \&\fBCMS_encrypt()\fR with the flag \fBCMS_PARTIAL\fR set.
  101. .SH NOTES
  102. .IX Header "NOTES"
  103. The main purpose of this function is to provide finer control over a CMS
  104. enveloped data structure where the simpler \fBCMS_encrypt()\fR function defaults are
  105. not appropriate. For example if one or more KEKRecipientInfo structures
  106. need to be added. New attributes can also be added using the returned
  107. CMS_RecipientInfo structure and the CMS attribute utility functions.
  108. .PP
  109. OpenSSL will by default identify recipient certificates using issuer name
  110. and serial number. If \fBCMS_USE_KEYID\fR is set it will use the subject key
  111. identifier value instead. An error occurs if all recipient certificates do not
  112. have a subject key identifier extension.
  113. .PP
  114. Currently only AES based key wrapping algorithms are supported for \fBnid\fR,
  115. specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wrap.
  116. If \fBnid\fR is set to \fBNID_undef\fR then an AES wrap algorithm will be used
  117. consistent with \fBkeylen\fR.
  118. .SH "RETURN VALUES"
  119. .IX Header "RETURN VALUES"
  120. \&\fBCMS_add1_recipient_cert()\fR and \fBCMS_add0_recipient_key()\fR return an internal
  121. pointer to the CMS_RecipientInfo structure just added or NULL if an error
  122. occurs.
  123. .SH "SEE ALSO"
  124. .IX Header "SEE ALSO"
  125. \&\fBERR_get_error\fR\|(3), \fBCMS_decrypt\fR\|(3),
  126. \&\fBCMS_final\fR\|(3),
  127. .SH HISTORY
  128. .IX Header "HISTORY"
  129. \&\fBCMS_add1_recipient_cert\fR and \fBCMS_add0_recipient_key\fR were added in
  130. OpenSSL 3.0.
  131. .SH COPYRIGHT
  132. .IX Header "COPYRIGHT"
  133. Copyright 2008\-2020 The OpenSSL Project Authors. All Rights Reserved.
  134. .PP
  135. Licensed under the Apache License 2.0 (the "License"). You may not use
  136. this file except in compliance with the License. You can obtain a copy
  137. in the file LICENSE in the source distribution or at
  138. <https://www.openssl.org/source/license.html>.