2
0

CMS_add1_recipient_cert.pod 2.7 KB

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