PKCS7_sign_add_signer.pod 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. =pod
  2. =head1 NAME
  3. PKCS7_sign_add_signer - add a signer PKCS7 signed data structure.
  4. =head1 SYNOPSIS
  5. #include <openssl/pkcs7.h>
  6. PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, int flags);
  7. =head1 DESCRIPTION
  8. PKCS7_sign_add_signer() adds a signer with certificate B<signcert> and private
  9. key B<pkey> using message digest B<md> to a PKCS7 signed data structure
  10. B<p7>.
  11. The PKCS7 structure should be obtained from an initial call to PKCS7_sign()
  12. with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PKCS7
  13. signed data structure.
  14. If the B<md> parameter is B<NULL> then the default digest for the public
  15. key algorithm will be used.
  16. Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned PKCS7 structure
  17. is not complete and must be finalized either by streaming (if applicable) or
  18. a call to PKCS7_final().
  19. =head1 NOTES
  20. The main purpose of this function is to provide finer control over a PKCS#7
  21. signed data structure where the simpler PKCS7_sign() function defaults are
  22. not appropriate. For example if multiple signers or non default digest
  23. algorithms are needed.
  24. Any of the following flags (ored together) can be passed in the B<flags>
  25. parameter.
  26. If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content
  27. digest value from the PKCS7 struture: to add a signer to an existing structure.
  28. An error occurs if a matching digest value cannot be found to copy. The
  29. returned PKCS7 structure will be valid and finalized when this flag is set.
  30. If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the
  31. B<PKCS7_SIGNER_INO> structure will not be finalized so additional attributes
  32. can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is
  33. needed to finalize it.
  34. If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the
  35. PKCS7 structure, the signer's certificate must still be supplied in the
  36. B<signcert> parameter though. This can reduce the size of the signature if the
  37. signers certificate can be obtained by other means: for example a previously
  38. signed message.
  39. The signedData structure includes several PKCS#7 autenticatedAttributes
  40. including the signing time, the PKCS#7 content type and the supported list of
  41. ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no
  42. authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then just
  43. the SMIMECapabilities are omitted.
  44. If present the SMIMECapabilities attribute indicates support for the following
  45. algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of
  46. these algorithms is disabled then it will not be included.
  47. PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO
  48. structure just added, this can be used to set additional attributes
  49. before it is finalized.
  50. =head1 RETURN VALUES
  51. PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO
  52. structure just added or NULL if an error occurs.
  53. =head1 SEE ALSO
  54. L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
  55. L<PKCS7_final(3)|PKCS7_final(3)>,
  56. =head1 HISTORY
  57. PPKCS7_sign_add_signer() was added to OpenSSL 0.9.9
  58. =cut