CMS_add1_recipient_cert.pod 2.5 KB

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