2
0

OSSL_CMP_SRV_CTX_new.pod 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. =pod
  2. =head1 NAME
  3. OSSL_CMP_SRV_process_request,
  4. OSSL_CMP_CTX_server_perform,
  5. OSSL_CMP_SRV_CTX_new,
  6. OSSL_CMP_SRV_CTX_free,
  7. OSSL_CMP_SRV_cert_request_cb_t,
  8. OSSL_CMP_SRV_rr_cb_t,
  9. OSSL_CMP_SRV_certConf_cb_t,
  10. OSSL_CMP_SRV_genm_cb_t,
  11. OSSL_CMP_SRV_error_cb_t,
  12. OSSL_CMP_SRV_pollReq_cb_t,
  13. OSSL_CMP_SRV_CTX_init,
  14. OSSL_CMP_SRV_CTX_get0_cmp_ctx,
  15. OSSL_CMP_SRV_CTX_get0_custom_ctx,
  16. OSSL_CMP_SRV_CTX_set_send_unprotected_errors,
  17. OSSL_CMP_SRV_CTX_set_accept_unprotected,
  18. OSSL_CMP_SRV_CTX_set_accept_raverified,
  19. OSSL_CMP_SRV_CTX_set_grant_implicit_confirm
  20. - generic functions to set up and control a CMP server
  21. =head1 SYNOPSIS
  22. #include <openssl/cmp.h>
  23. OSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx,
  24. const OSSL_CMP_MSG *req);
  25. OSSL_CMP_MSG *OSSL_CMP_CTX_server_perform(OSSL_CMP_CTX *client_ctx,
  26. const OSSL_CMP_MSG *req);
  27. OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);
  28. void OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx);
  29. typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_cert_request_cb_t)(
  30. OSSL_CMP_SRV_CTX *srv_ctx,
  31. const OSSL_CMP_MSG *req,
  32. int certReqId,
  33. const OSSL_CRMF_MSG *crm,
  34. const X509_REQ *p10cr,
  35. X509 **certOut,
  36. STACK_OF(X509) **chainOut,
  37. STACK_OF(X509) **caPubs);
  38. typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_rr_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
  39. const OSSL_CMP_MSG *req,
  40. const X509_NAME *issuer,
  41. const ASN1_INTEGER *serial);
  42. typedef int (*OSSL_CMP_SRV_genm_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
  43. const OSSL_CMP_MSG *req,
  44. STACK_OF(OSSL_CMP_ITAV) *in,
  45. STACK_OF(OSSL_CMP_ITAV) **out);
  46. typedef void (*OSSL_CMP_SRV_error_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
  47. const OSSL_CMP_MSG *req,
  48. const OSSL_CMP_PKISI *statusInfo,
  49. const ASN1_INTEGER *errorCode,
  50. const OSSL_CMP_PKIFREETEXT *errorDetails);
  51. typedef int (*OSSL_CMP_SRV_certConf_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
  52. const OSSL_CMP_MSG *req,
  53. int certReqId,
  54. const ASN1_OCTET_STRING *certHash,
  55. const OSSL_CMP_PKISI *si);
  56. typedef int (*OSSL_CMP_SRV_pollReq_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
  57. const OSSL_CMP_MSG *req,
  58. int certReqId,
  59. OSSL_CMP_MSG **certReq,
  60. int64_t *check_after);
  61. int OSSL_CMP_SRV_CTX_init(OSSL_CMP_SRV_CTX *srv_ctx, void *custom_ctx,
  62. OSSL_CMP_SRV_cert_request_cb_t process_cert_request,
  63. OSSL_CMP_SRV_rr_cb_t process_rr,
  64. OSSL_CMP_SRV_genm_cb_t process_genm,
  65. OSSL_CMP_SRV_error_cb_t process_error,
  66. OSSL_CMP_SRV_certConf_cb_t process_certConf,
  67. OSSL_CMP_SRV_pollReq_cb_t process_pollReq);
  68. OSSL_CMP_CTX *OSSL_CMP_SRV_CTX_get0_cmp_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);
  69. void *OSSL_CMP_SRV_CTX_get0_custom_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);
  70. int OSSL_CMP_SRV_CTX_set_send_unprotected_errors(OSSL_CMP_SRV_CTX *srv_ctx,
  71. int val);
  72. int OSSL_CMP_SRV_CTX_set_accept_unprotected(OSSL_CMP_SRV_CTX *srv_ctx, int val);
  73. int OSSL_CMP_SRV_CTX_set_accept_raverified(OSSL_CMP_SRV_CTX *srv_ctx, int val);
  74. int OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(OSSL_CMP_SRV_CTX *srv_ctx,
  75. int val);
  76. =head1 DESCRIPTION
  77. OSSL_CMP_SRV_process_request() implements the generic aspects of a CMP server.
  78. Its arguments are the B<OSSL_CMP_SRV_CTX> I<srv_ctx> and the CMP request message
  79. I<req>. It does the typical generic checks on I<req>, calls
  80. the respective callback function (if present) for more specific processing,
  81. and then assembles a result message, which may be a CMP error message.
  82. OSSL_CMP_CTX_server_perform() is an interface to
  83. B<OSSL_CMP_SRV_process_request()> that can be used by a CMP client
  84. in the same way as B<OSSL_CMP_MSG_http_perform()>.
  85. The B<OSSL_CMP_SRV_CTX> must be set as I<transfer_cb_arg> of I<client_ctx>.
  86. OSSL_CMP_SRV_CTX_new() creates and initializes an B<OSSL_CMP_SRV_CTX> structure
  87. associated with the library context I<libctx> and property query string
  88. I<propq>, both of which may be NULL to select the defaults.
  89. OSSL_CMP_SRV_CTX_free() deletes the given I<srv_ctx>.
  90. OSSL_CMP_SRV_CTX_init() sets in the given I<srv_ctx> a custom server context
  91. pointer as well as callback functions performing the specific processing of CMP
  92. certificate requests, revocation requests, certificate confirmation requests,
  93. general messages, error messages, and poll requests.
  94. All arguments except I<srv_ctx> may be NULL.
  95. If a callback for some message type is not given this means that the respective
  96. type of CMP message is not supported by the server.
  97. OSSL_CMP_SRV_CTX_get0_cmp_ctx() returns the B<OSSL_CMP_CTX> from the I<srv_ctx>.
  98. OSSL_CMP_SRV_CTX_get0_custom_ctx() returns the custom server context from
  99. I<srv_ctx> that has been set using B<OSSL_CMP_SRV_CTX_init()>.
  100. OSSL_CMP_SRV_CTX_set_send_unprotected_errors() enables sending error messages
  101. and other forms of negative responses unprotected.
  102. OSSL_CMP_SRV_CTX_set_accept_unprotected() enables acceptance of requests
  103. without protection of with invalid protection.
  104. OSSL_CMP_SRV_CTX_set_accept_raverified() enables acceptance of ir/cr/kur
  105. messages with POPO 'RAVerified'.
  106. OSSL_CMP_SRV_CTX_set_grant_implicit_confirm() enables granting implicit
  107. confirmation of newly enrolled certificates if requested.
  108. =head1 NOTES
  109. CMP is defined in RFC 4210 (and CRMF in RFC 4211).
  110. So far the CMP server implementation is limited to one request per CMP message
  111. (and consequently to at most one response component per CMP message).
  112. =head1 RETURN VALUES
  113. OSSL_CMP_SRV_CTX_new() returns a B<OSSL_CMP_SRV_CTX> structure on success,
  114. NULL on error.
  115. OSSL_CMP_SRV_CTX_free() does not return a value.
  116. OSSL_CMP_SRV_CTX_get0_cmp_ctx() returns a B<OSSL_CMP_CTX> structure on success,
  117. NULL on error.
  118. OSSL_CMP_SRV_CTX_get0_custom_ctx() returns the custom server context
  119. that has been set using B<OSSL_CMP_SRV_CTX_init()>.
  120. All other functions return 1 on success, 0 on error.
  121. =head1 HISTORY
  122. The OpenSSL CMP support was added in OpenSSL 3.0.
  123. =head1 COPYRIGHT
  124. Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
  125. Licensed under the Apache License 2.0 (the "License"). You may not use
  126. this file except in compliance with the License. You can obtain a copy
  127. in the file LICENSE in the source distribution or at
  128. L<https://www.openssl.org/source/license.html>.
  129. =cut