ossl_cmp_certreq_new.pod 6.6 KB

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