ossl_cmp_certreq_new.pod 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. =pod
  2. =head1 NAME
  3. ossl_cmp_certreq_new,
  4. ossl_cmp_certrep_new,
  5. ossl_cmp_rr_new,
  6. ossl_cmp_rp_new,
  7. ossl_cmp_certConf_new,
  8. ossl_cmp_pkiconf_new,
  9. ossl_cmp_pollReq_new,
  10. ossl_cmp_pollRep_new,
  11. ossl_cmp_genm_new,
  12. ossl_cmp_genp_new,
  13. ossl_cmp_error_new
  14. - functions for generating CMP messages
  15. =head1 SYNOPSIS
  16. #include "cmp_local.h"
  17. OSSL_ossl_cmp_MSG *ossl_cmp_certreq_new(OSSL_CMP_CTX *ctx, int bodytype,
  18. const OSSL_CRMF_MSG *crm);
  19. OSSL_CMP_MSG *ossl_cmp_certrep_new(OSSL_CMP_CTX *ctx, int bodytype,
  20. int certReqId, const OSSL_CMP_PKISI *si,
  21. X509 *cert, const X509 *encryption_recip,
  22. STACK_OF(X509) *chain, STACK_OF(X509) *caPubs,
  23. int unprotectedErrors);
  24. OSSL_CMP_MSG *ossl_cmp_rr_new(OSSL_CMP_CTX *ctx);
  25. OSSL_CMP_MSG *ossl_cmp_rp_new(OSSL_CMP_CTX *ctx, const OSSL_CMP_PKISI *si,
  26. const OSSL_CRMF_CERTID *cid,
  27. int unprotectedErrors);
  28. OSSL_CMP_MSG *ossl_cmp_certConf_new(OSSL_CMP_CTX *ctx, int certReqId,
  29. int fail_info, const char *text);
  30. OSSL_CMP_MSG *ossl_cmp_pkiconf_new(OSSL_CMP_CTX *ctx);
  31. OSSL_CMP_MSG *ossl_cmp_pollReq_new(OSSL_CMP_CTX *ctx, int crid);
  32. OSSL_CMP_MSG *ossl_cmp_pollRep_new(OSSL_CMP_CTX *ctx, int crid, int poll_after);
  33. OSSL_CMP_MSG *ossl_cmp_genm_new(OSSL_CMP_CTX *ctx);
  34. OSSL_CMP_MSG *ossl_cmp_genp_new(OSSL_CMP_CTX *ctx);
  35. OSSL_CMP_MSG *ossl_cmp_error_new(OSSL_CMP_CTX *ctx, const OSSL_CMP_PKISI *si,
  36. int64_t errorCode, const char *details,
  37. int unprotected);
  38. =head1 DESCRIPTION
  39. This is the internal API for creating various CMP PKIMESSAGES.
  40. All functions are based on L<ossl_cmp_msg_create(3)>.
  41. The allocate a new message, fill it with the relevant data derived from
  42. the given B<OSSL_CMP_CTX>, and create the applicable protection.
  43. ossl_cmp_certreq_new() creates a PKIMessage for requesting a certificate,
  44. which can be either of IR/CR/KUR/P10CR, depending on the given I<bodytype>.
  45. The CRMF message to use may be given explicitly via a non-NULL I<crm> argument,
  46. otherwise it is created from the information in the I<ctx>.
  47. Available CMP certificate request PKIMessage I<bodytype>s are:
  48. =over 4
  49. =item * B<OSSL_CMP_PKIBODY_IR> - Initialization Request
  50. =item * B<OSSL_CMP_PKIBODY_CR> - Certification Request
  51. =item * B<OSSL_CMP_PKIBODY_P10CR> - PKCS#10 Certification Request
  52. =item * B<OSSL_CMP_PKIBODY_KUR> - Key Update Request
  53. =back
  54. ossl_cmp_certrep_new() creates a PKIMessage for certificate response,
  55. which can be either of IP/CP/KUP, depending on the given I<bodytype>,
  56. with the given I<certReqId> and I<si> values and optionally with I<cert>,
  57. I<chain>, and I<caPubs>. The I<cert>, I<chain>, and I<caPubs> arguments
  58. are not consumed if present but their internal reference counter is increased.
  59. The I<encryption_recip> is currently unsupported.
  60. The function does not protect the message if the B<status> value in I<si>
  61. is B<rejected> and I<unprotectedErrors> is nonzero.
  62. Available CMP certificate response PKIMessage I<bodytype>s are:
  63. =over 4
  64. =item * B<OSSL_CMP_PKIBODY_IP> - Initialization Response
  65. =item * B<OSSL_CMP_PKIBODY_CP> - Certification Response
  66. =item * B<OSSL_CMP_PKIBODY_KUP> - Key Update Response
  67. =back
  68. The list of all CMP PKIMessage I<bodytype>s is:
  69. #define OSSL_CMP_PKIBODY_IR 0
  70. #define OSSL_CMP_PKIBODY_IP 1
  71. #define OSSL_CMP_PKIBODY_CR 2
  72. #define OSSL_CMP_PKIBODY_CP 3
  73. #define OSSL_CMP_PKIBODY_P10CR 4
  74. #define OSSL_CMP_PKIBODY_POPDECC 5
  75. #define OSSL_CMP_PKIBODY_POPDECR 6
  76. #define OSSL_CMP_PKIBODY_KRR 9
  77. #define OSSL_CMP_PKIBODY_KRP 10
  78. #define OSSL_CMP_PKIBODY_RR 11
  79. #define OSSL_CMP_PKIBODY_RP 12
  80. #define OSSL_CMP_PKIBODY_CCR 13
  81. #define OSSL_CMP_PKIBODY_CCP 14
  82. #define OSSL_CMP_PKIBODY_CKUANN 15
  83. #define OSSL_CMP_PKIBODY_CANN 16
  84. #define OSSL_CMP_PKIBODY_RANN 17
  85. #define OSSL_CMP_PKIBODY_CRLANN 18
  86. #define OSSL_CMP_PKIBODY_PKICONF 19
  87. #define OSSL_CMP_PKIBODY_NESTED 20
  88. #define OSSL_CMP_PKIBODY_GENM 21
  89. #define OSSL_CMP_PKIBODY_GENP 22
  90. #define OSSL_CMP_PKIBODY_ERROR 23
  91. #define OSSL_CMP_PKIBODY_CERTCONF 24
  92. #define OSSL_CMP_PKIBODY_POLLREQ 25
  93. #define OSSL_CMP_PKIBODY_POLLREP 26
  94. ossl_cmp_rr_new() creates a Revocation Request message from the
  95. information set via OSSL_CMP_CTX_set1_oldClCert().
  96. ossl_cmp_rp_new() creates a Revocation Response message with I<si> and I<cid>.
  97. It does not protect the message if the B<status> value in I<si> is B<rejected>
  98. and I<unprotectedErrors> is nonzero.
  99. ossl_cmp_certConf_new() creates a Certificate Confirmation message for the last
  100. received certificate with the given I<certReqId>.
  101. The PKIStatus defaults to B<accepted> if the I<fail_info> bit field is 0.
  102. Otherwise it is taken as the failInfo of the PKIStatusInfo, PKIStatus is
  103. set to B<rejected>, and I<text> is copied to statusString unless it is NULL.
  104. ossl_cmp_pkiconf_new() creates a PKI Confirmation message.
  105. ossl_cmp_pollReq_new() creates a Polling Request message with certReqId set to
  106. I<crid>.
  107. ossl_cmp_pollRep_new() creates a Polling Response message with certReqId set to
  108. I<crid> and pollAfter to I<poll_after>.
  109. ossl_cmp_genm_new() creates a new General Message with an empty ITAV stack.
  110. ossl_cmp_genp_new() creates a new General Response with an empty ITAV stack.
  111. ossl_cmp_error_new() creates a new Error Message with the given contents
  112. I<si>, I<errorCode>, and optional I<details>.
  113. If I<errorCode> is positive and in the range of an OpenSSL error code,
  114. the library and reason strings are included in the B<errorDetails> field.
  115. If given, the I<details> are added to the contents of the B<errorDetails> field.
  116. The function does not protect the message if I<unprotectedErrors> is nonzero.
  117. =head1 NOTES
  118. CMP is specified in RFC 4210 (and CRMF in RFC 4211).
  119. =head1 RETURN VALUES
  120. All of the functions return a new OSSL_CMP_MSG structure containing
  121. the generated message on success, or NULL on error.
  122. =head1 SEE ALSO
  123. L<ossl_cmp_msg_create(3)>,
  124. L<OSSL_CMP_CTX_new(3)>, L<ERR_load_strings(3)>
  125. =head1 HISTORY
  126. The OpenSSL CMP support was added in OpenSSL 3.0.
  127. =head1 COPYRIGHT
  128. Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.
  129. Licensed under the Apache License 2.0 (the "License"). You may not use
  130. this file except in compliance with the License. You can obtain a copy
  131. in the file LICENSE in the source distribution or at
  132. L<https://www.openssl.org/source/license.html>.
  133. =cut