PKCS7_sign_add_signer.pod 3.4 KB

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