]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/OSSL_CMP_exec_IR_ses.pod
Update copyright year
[thirdparty/openssl.git] / doc / man3 / OSSL_CMP_exec_IR_ses.pod
CommitLineData
7e765f46
DDO
1=pod
2
3=head1 NAME
4
5OSSL_CMP_exec_IR_ses,
6OSSL_CMP_exec_CR_ses,
7OSSL_CMP_exec_P10CR_ses,
8OSSL_CMP_exec_KUR_ses,
9OSSL_CMP_IR,
10OSSL_CMP_CR,
11OSSL_CMP_P10CR,
12OSSL_CMP_KUR,
13OSSL_CMP_try_certreq,
14OSSL_CMP_exec_RR_ses,
15OSSL_CMP_exec_GENM_ses,
16OSSL_CMP_certConf_cb
17- functions implementing CMP client transactions
18
19=head1 SYNOPSIS
20
21 #include <openssl/cmp.h>
22
23 X509 *OSSL_CMP_exec_IR_ses(OSSL_CMP_CTX *ctx);
24 X509 *OSSL_CMP_exec_CR_ses(OSSL_CMP_CTX *ctx);
25 X509 *OSSL_CMP_exec_P10CR_ses(OSSL_CMP_CTX *ctx);
26 X509 *OSSL_CMP_exec_KUR_ses(OSSL_CMP_CTX *ctx);
27 #define OSSL_CMP_IR
28 #define OSSL_CMP_CR
29 #define OSSL_CMP_P10CR
30 #define OSSL_CMP_KUR
31 int OSSL_CMP_try_certreq(OSSL_CMP_CTX *ctx, int req_type, int *checkAfter);
32 int OSSL_CMP_certConf_cb(OSSL_CMP_CTX *ctx, X509 *cert, int fail_info,
33 const char **text);
34 X509 *OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx);
35 STACK_OF(OSSL_CMP_ITAV) *OSSL_CMP_exec_GENM_ses(OSSL_CMP_CTX *ctx);
36
37=head1 DESCRIPTION
38
39This is the OpenSSL API for doing CMP (Certificate Management Protocol)
40client-server transactions, i.e., sequences of CMP requests and responses.
41
42All functions take a populated OSSL_CMP_CTX structure as their first argument.
43Usually the server name, port, and path ("CMP alias") need to be set, as well as
44credentials the client can use for authenticating itself to the client.
45In order to authenticate the server the client typically needs a trust store.
46For performing certificate enrollment requests the certificate template needs
47to be sufficiently filled in, giving at least the subject name and key.
48The functions return their respective main results directly, while there are
49also accessor functions for retrieving various results and status information
50from the B<ctx>. See L<OSSL_CMP_CTX_new(3)> etc. for details.
51
52The default conveying protocol is HTTP.
53Timeout values may be given per request-response pair and per transaction.
54See L<OSSL_CMP_MSG_http_perform(3)> for details.
55
56OSSL_CMP_exec_IR_ses() requests an initial certificate from the given PKI.
57
58OSSL_CMP_exec_CR_ses() requests an additional certificate.
59
60OSSL_CMP_exec_P10CR_ses() conveys a legacy PKCS#10 CSR requesting a certificate.
61
62OSSL_CMP_exec_KUR_ses() obtains an updated certificate.
63
64All these four types of certificate enrollment may be blocked by sleeping until the
65CAs or an intermedate PKI component can fully process and answer the request.
66
67OSSL_CMP_try_certreq() is an alternative to these four functions that is
68more uniform regarding the type of the certificate request to use and
69more flexible regarding what to do after receiving a checkAfter value.
70When called for the first time (with no certificate request in progress for
71the given B<ctx>) it starts a new transaction by sending a certificate request
72of the given type,
73which may be IR, CR, P10CR, or KUR as specified by the B<req_type> parameter.
74Otherwise (when according to B<ctx> a 'waiting' status has been received before)
75it continues polling for the pending request
76unless the B<req_type> argument is < 0, which aborts the request.
77If the requested certificate is available the function returns 1 and the
78caller can use B<OSSL_CMP_CTX_get0_newCert()> to retrieve the new certificate.
79If no error occurred but no certificate is available yet then
80OSSL_CMP_try_certreq() remembers in the CMP context that it should be retried
81and returns -1 after assigning the received checkAfter value
82via the output pointer argument (unless it is NULL).
83The checkAfter value indicates the number of seconds the caller should let pass
84before trying again. The caller is free to sleep for the given number of seconds
85or for some other time and/or to do anything else before retrying by calling
86OSSL_CMP_try_certreq() again with the same parameter values as before.
87OSSL_CMP_try_certreq() then polls
88to see whether meanwhile the requested certificate is available.
89If the caller decides to abort the pending certificate request and provides
90a negative value as the B<req_type> argument then OSSL_CMP_try_certreq()
91aborts the CMP transaction by sending an error message to the server.
92
93OSSL_CMP_certConf_cb() is a basic certificate confirmation callback validating
94that the new certificate can be verified with the trusted/untrusted certificates
95in B<ctx>.
96As there is no requirement in RFC 4210 that the certificate can be
97validated by the client, this callback is not set by default in the context.
98
99OSSL_CMP_exec_RR_ses() requests the revocation of the certificate
100specified in the B<ctx> using L<OSSL_CMP_CTX_set1_oldCert(3)>.
101RFC 4210 is vague in which PKIStatus should be returned by the server.
102We take "accepted" and "grantedWithMods" as clear success and handle
103"revocationWarning" and "revocationNotification" just as warnings because CAs
104typically return them as an indication that the certificate was already revoked.
105"rejection" is a clear error. The values "waiting" and "keyUpdateWarning"
106make no sense for revocation and thus are treated as an error as well.
107
108OSSL_CMP_exec_GENM_ses() sends a general message containing the sequence of
109infoType and infoValue pairs (InfoTypeAndValue; short: B<ITAV>)
110provided in the B<ctx> using L<OSSL_CMP_CTX_push0_genm_ITAV(3)>.
111It returns the list of B<ITAV>s received in the GenRep.
112This can be used, for instance, to poll for CRLs or CA Key Updates.
113See RFC 4210 section 5.3.19 and appendix E.5 for details.
114
115=head1 NOTES
116
117CMP is defined in RFC 4210 (and CRMF in RFC 4211).
118
119So far the CMP client implementation is limited to one request per CMP message
120(and consequently to at most one response component per CMP message).
121
122=head1 RETURN VALUES
123
124OSSL_CMP_exec_IR_ses(), OSSL_CMP_exec_CR_ses(),
125OSSL_CMP_exec_P10CR_ses(), and OSSL_CMP_exec_KUR_ses() return a
126pointer to the newly obtained X509 certificate on success, B<NULL> on error.
127This pointer will be freed implicitly by OSSL_CMP_CTX_free() or
128CSSL_CMP_CTX_reinit().
129
130OSSL_CMP_try_certreq() returns 1 if the requested certificate is available
131via B<OSSL_CMP_CTX_get0_newCert()>
132or on successfully aborting a pending certificate request, 0 on error, and -1
133in case a 'waiting' status has been received and checkAfter value is available.
134In the latter case B<OSSL_CMP_CTX_get0_newCert()> yields NULL
135and the output parameter B<checkAfter> has been used to
136assign the received value unless B<checkAfter> is NULL.
137
138OSSL_CMP_certConf_cb() returns B<fail_info> if it is not equal to B<0>,
139else B<0> on successful validation,
140or else a bit field with the B<OSSL_CMP_PKIFAILUREINFO_incorrectData> bit set.
141
142OSSL_CMP_exec_RR_ses() returns the
143pointer to the revoked certificate on success, B<NULL> on error.
144This pointer will be freed implicitly by OSSL_CMP_CTX_free().
145
146OSSL_CMP_exec_GENM_ses() returns a
147pointer to the received B<ITAV> sequence on success, B<NULL> on error.
148This pointer must be freed by the caller.
149
150=head1 EXAMPLES
151
152See OSSL_CMP_CTX for examples on how to prepare the context for these
153functions.
154
155=head1 SEE ALSO
156
157L<OSSL_CMP_CTX_new(3)>, L<OSSL_CMP_MSG_http_perform(3)>
158
159=head1 HISTORY
160
161The OpenSSL CMP support was added in OpenSSL 3.0.
162
163=head1 COPYRIGHT
164
33388b44 165Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
7e765f46
DDO
166
167Licensed under the Apache License 2.0 (the "License"). You may not use
168this file except in compliance with the License. You can obtain a copy
169in the file LICENSE in the source distribution or at
170L<https://www.openssl.org/source/license.html>.
171
172=cut