CMS_add1_recipient_cert.pod 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. =pod
  2. =head1 NAME
  3. CMS_add1_recipient, CMS_add1_recipient_cert, CMS_add0_recipient_key - add recipients to a CMS enveloped data structure
  4. =head1 SYNOPSIS
  5. #include <openssl/cms.h>
  6. CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,
  7. EVP_PKEY *originatorPrivKey,
  8. X509 *originator, unsigned int flags);
  9. CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
  10. X509 *recip, unsigned int flags);
  11. CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
  12. unsigned char *key, size_t keylen,
  13. unsigned char *id, size_t idlen,
  14. ASN1_GENERALIZEDTIME *date,
  15. ASN1_OBJECT *otherTypeId,
  16. ASN1_TYPE *otherType);
  17. =head1 DESCRIPTION
  18. CMS_add1_recipient() adds recipient B<recip> and provides the originator pkey
  19. B<originatorPrivKey> and originator certificate B<originator> to CMS_ContentInfo.
  20. The originator-related fields are relevant only in case when the keyAgreement
  21. method of providing of the shared key is in use.
  22. CMS_add1_recipient_cert() adds recipient B<recip> to CMS_ContentInfo enveloped
  23. data structure B<cms> as a KeyTransRecipientInfo structure.
  24. CMS_add0_recipient_key() adds symmetric key B<key> of length B<keylen> using
  25. wrapping algorithm B<nid>, identifier B<id> of length B<idlen> and optional
  26. values B<date>, B<otherTypeId> and B<otherType> to CMS_ContentInfo enveloped
  27. data structure B<cms> as a KEKRecipientInfo structure.
  28. The CMS_ContentInfo structure should be obtained from an initial call to
  29. CMS_encrypt() with the flag B<CMS_PARTIAL> set.
  30. =head1 NOTES
  31. The main purpose of this function is to provide finer control over a CMS
  32. enveloped data structure where the simpler CMS_encrypt() function defaults are
  33. not appropriate. For example if one or more KEKRecipientInfo structures
  34. need to be added. New attributes can also be added using the returned
  35. CMS_RecipientInfo structure and the CMS attribute utility functions.
  36. OpenSSL will by default identify recipient certificates using issuer name
  37. and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
  38. identifier value instead. An error occurs if all recipient certificates do not
  39. have a subject key identifier extension.
  40. Currently only AES based key wrapping algorithms are supported for B<nid>,
  41. specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wrap.
  42. If B<nid> is set to B<NID_undef> then an AES wrap algorithm will be used
  43. consistent with B<keylen>.
  44. =head1 RETURN VALUES
  45. CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal
  46. pointer to the CMS_RecipientInfo structure just added or NULL if an error
  47. occurs.
  48. =head1 SEE ALSO
  49. L<ERR_get_error(3)>, L<CMS_decrypt(3)>,
  50. L<CMS_final(3)>,
  51. =head1 HISTORY
  52. B<CMS_add1_recipient_cert> and B<CMS_add0_recipient_key> were added in
  53. OpenSSL 3.0.
  54. =head1 COPYRIGHT
  55. Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.
  56. Licensed under the Apache License 2.0 (the "License"). You may not use
  57. this file except in compliance with the License. You can obtain a copy
  58. in the file LICENSE in the source distribution or at
  59. L<https://www.openssl.org/source/license.html>.
  60. =cut