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