ossl_cmp_mock_srv_new.pod 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. =pod
  2. =head1 NAME
  3. ossl_cmp_mock_srv_new,
  4. ossl_cmp_mock_srv_free,
  5. ossl_cmp_mock_srv_set1_refCert,
  6. ossl_cmp_mock_srv_set1_certOut,
  7. ossl_cmp_mock_srv_set1_chainOut,
  8. ossl_cmp_mock_srv_set1_caPubsOut,
  9. ossl_cmp_mock_srv_set1_newWithNew,
  10. ossl_cmp_mock_srv_set1_newWithOld,
  11. ossl_cmp_mock_srv_set1_oldWithNew,
  12. ossl_cmp_mock_srv_set_statusInfo,
  13. ossl_cmp_mock_srv_set_sendError,
  14. ossl_cmp_mock_srv_set_pollCount,
  15. ossl_cmp_mock_srv_set_checkAfterTime
  16. - functions used for testing with CMP mock server
  17. =head1 SYNOPSIS
  18. #include "apps/cmp_mock_srv.h"
  19. OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OSSL_LIB_CTX *libctx, const char *propq);
  20. void ossl_cmp_mock_srv_free(OSSL_CMP_SRV_CTX *srv_ctx);
  21. int ossl_cmp_mock_srv_set1_refCert(OSSL_CMP_SRV_CTX *ctx, const X509 *cert);
  22. int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *ctx, const X509 *cert);
  23. int ossl_cmp_mock_srv_set1_chainOut(OSSL_CMP_SRV_CTX *srv_ctx,
  24. const STACK_OF(X509) *chain);
  25. int ossl_cmp_mock_srv_set1_caPubsOut(OSSL_CMP_SRV_CTX *srv_ctx,
  26. const STACK_OF(X509) *caPubs);
  27. int ossl_cmp_mock_srv_set1_newWithNew(OSSL_CMP_SRV_CTX *ctx, const X509 *cert);
  28. int ossl_cmp_mock_srv_set1_newWithOld(OSSL_CMP_SRV_CTX *ctx, const X509 *cert);
  29. int ossl_cmp_mock_srv_set1_oldWithNew(OSSL_CMP_SRV_CTX *ctx, const X509 *cert);
  30. int ossl_cmp_mock_srv_set_statusInfo(OSSL_CMP_SRV_CTX *srv_ctx, int status,
  31. int fail_info, const char *text);
  32. int ossl_cmp_mock_srv_set_sendError(OSSL_CMP_SRV_CTX *srv_ctx, int bodytype);
  33. int ossl_cmp_mock_srv_set_pollCount(OSSL_CMP_SRV_CTX *srv_ctx, int count);
  34. int ossl_cmp_mock_srv_set_checkAfterTime(OSSL_CMP_SRV_CTX *srv_ctx, int sec);
  35. =head1 DESCRIPTION
  36. ossl_cmp_mock_srv_new() allocates the contexts for the CMP mock server
  37. associated with the library context I<libctx> and property query string
  38. I<propq>, both of which may be NULL to select the defaults.
  39. ossl_cmp_mock_srv_free() deallocates the contexts for the CMP mock server.
  40. ossl_cmp_mock_srv_set1_refCert() sets the reference certificate (or NULL)
  41. to be expected for rr messages and for any oldCertID included in kur messages.
  42. ossl_cmp_mock_srv_set1_certOut() sets the certificate (or NULL)
  43. to be returned in cp/ip/kup messages.
  44. Note that on each certificate request the mock server does not produce
  45. a fresh certificate but just returns the same pre-existing certificate.
  46. ossl_cmp_mock_srv_set1_chainOut() sets the certificate chain (or NULL)
  47. to be added to the extraCerts in a cp/ip/kup message.
  48. It should be useful for the validation of the certificate given via
  49. ossl_cmp_mock_srv_set1_certOut().
  50. ossl_cmp_mock_srv_set1_caPubsOut() sets list of certificates (or NULL) to be
  51. returned in the caPubs field an ip message and in a genp of infoType caCerts.
  52. ossl_cmp_mock_srv_set1_newWithNew() sets the value (which may be NULL)
  53. of the newWithNew field to be returned in a genp of infoType rootCaKeyUpdate.
  54. ossl_cmp_mock_srv_set1_newWithOld() sets the value (which may be NULL)
  55. of the newWithOld field to be returned in a genp of infoType rootCaKeyUpdate.
  56. ossl_cmp_mock_srv_set1_oldWithNew() sets the value (which may be NULL)
  57. of the oldWithNew field to be returned in a genp of infoType rootCaKeyUpdate.
  58. ossl_cmp_mock_srv_set_statusInfo() sets the status info to be returned.
  59. ossl_cmp_mock_srv_set_sendError() enables enforcement of error responses
  60. for requests of the given I<bodytype>, or for all requests if I<bodytype> is 1.
  61. A I<bodytype> of -1 can be used to disable this feature, which is the default.
  62. ossl_cmp_mock_srv_set_pollCount() sets the number of polls before cert response.
  63. ossl_cmp_mock_srv_set_checkAfterTime() sets the number of seconds
  64. the client should wait for the next poll.
  65. =head1 NOTES
  66. CMP is defined in RFC 4210 (and CRMF in RFC 4211).
  67. =head1 RETURN VALUES
  68. ossl_cmp_mock_srv() returns a B<OSSL_CMP_SRV_CTX> structure on success,
  69. NULL on error.
  70. ossl_cmp_mock_srv_free() does not return a value.
  71. All other functions return 1 on success, 0 on error.
  72. =head1 HISTORY
  73. The OpenSSL CMP support was added in OpenSSL 3.0.
  74. =head1 COPYRIGHT
  75. Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.
  76. Licensed under the Apache License 2.0 (the "License"). You may not use
  77. this file except in compliance with the License. You can obtain a copy
  78. in the file LICENSE in the source distribution or at
  79. L<https://www.openssl.org/source/license.html>.
  80. =cut