CMS_add1_recipient_cert.pod 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>,
  37. L<CMS_final(3)|CMS_final(3)>,
  38. =head1 HISTORY
  39. CMS_add1_recipient_cert() and CMS_add0_recipient_key() were added to OpenSSL
  40. 0.9.8
  41. =cut