6a720564558a755a1c292ab21c430a978364c655
[openssl.git] / doc / internal / man3 / ossl_cmp_statusinfo_new.pod
1 =pod
2
3 =head1 NAME
4
5 ossl_cmp_statusinfo_new,
6 ossl_cmp_pkisi_pkistatus_get,
7 ossl_cmp_pkisi_pkifailureinfo_get,
8 ossl_cmp_pkisi_pkifailureinfo_check,
9 ossl_cmp_pkisi_failinfo_get0,
10 ossl_cmp_pkisi_statusstring_get0,
11 ossl_pkisi_snprint
12 - functions for managing PKI status information
13
14 =head1 SYNOPSIS
15
16   #include "cmp.h"
17
18 # define OSSL_CMP_PKIFAILUREINFO_badAlg               0
19 # define OSSL_CMP_PKIFAILUREINFO_badMessageCheck      1
20 # define OSSL_CMP_PKIFAILUREINFO_badRequest           2
21 # define OSSL_CMP_PKIFAILUREINFO_badTime              3
22 # define OSSL_CMP_PKIFAILUREINFO_badCertId            4
23 # define OSSL_CMP_PKIFAILUREINFO_badDataFormat        5
24 # define OSSL_CMP_PKIFAILUREINFO_wrongAuthority       6
25 # define OSSL_CMP_PKIFAILUREINFO_incorrectData        7
26 # define OSSL_CMP_PKIFAILUREINFO_missingTimeStamp     8
27 # define OSSL_CMP_PKIFAILUREINFO_badPOP               9
28 # define OSSL_CMP_PKIFAILUREINFO_certRevoked         10
29 # define OSSL_CMP_PKIFAILUREINFO_certConfirmed       11
30 # define OSSL_CMP_PKIFAILUREINFO_wrongIntegrity      12
31 # define OSSL_CMP_PKIFAILUREINFO_badRecipientNonce   13
32 # define OSSL_CMP_PKIFAILUREINFO_timeNotAvailable    14
33 # define OSSL_CMP_PKIFAILUREINFO_unacceptedPolicy    15
34 # define OSSL_CMP_PKIFAILUREINFO_unacceptedExtension 16
35 # define OSSL_CMP_PKIFAILUREINFO_addInfoNotAvailable 17
36 # define OSSL_CMP_PKIFAILUREINFO_badSenderNonce      18
37 # define OSSL_CMP_PKIFAILUREINFO_badCertTemplate     19
38 # define OSSL_CMP_PKIFAILUREINFO_signerNotTrusted    20
39 # define OSSL_CMP_PKIFAILUREINFO_transactionIdInUse  21
40 # define OSSL_CMP_PKIFAILUREINFO_unsupportedVersion  22
41 # define OSSL_CMP_PKIFAILUREINFO_notAuthorized       23
42 # define OSSL_CMP_PKIFAILUREINFO_systemUnavail       24
43 # define OSSL_CMP_PKIFAILUREINFO_systemFailure       25
44 # define OSSL_CMP_PKIFAILUREINFO_duplicateCertReq    26
45 # define OSSL_CMP_PKIFAILUREINFO_MAX                 26
46
47   OSSL_CMP_PKISI *ossl_cmp_statusinfo_new(int status, int fail_info,
48                                           const char *text);
49   int ossl_cmp_pkisi_pkistatus_get(OSSL_CMP_PKISI *si);
50   int ossl_cmp_pkisi_pkifailureinfo_get(OSSL_CMP_PKISI *si);
51   int ossl_cmp_pkisi_pkifailureinfo_check(OSSL_CMP_PKISI *si, int bit_index);
52   OSSL_CMP_PKIFAILUREINFO *ossl_cmp_pkisi_failinfo_get0(const OSSL_CMP_PKISI *si);
53   OSSL_CMP_PKIFREETEXT *ossl_cmp_pkisi_statusstring_get0(const OSSL_CMP_PKISI *si);
54   char *ossl_pkisi_snprint(OSSL_CMP_PKISI *si, char *buf, int bufsize);
55
56 =head1 DESCRIPTION
57
58 ossl_cmp_statusinfo_new() creates a new PKIStatusInfo structure and fills it
59 with the given values. It sets the status field to B<status>.
60 If B<text> is not NULL, it is copied to statusString.
61 B<fail_info> is is interpreted as bit pattern for the failInfo field.
62 Returns a pointer to the structure on success, or NULL on error.
63
64 ossl_cmp_pkisi_pkistatus_get() returns the PKIStatus of B<si>, or -1 on error.
65
66 ossl_cmp_pkisi_pkifailureinfo_get() returns the PKIFailureInfo bits
67 of B<si>, encoded as integer, or -1 on error.
68
69 ossl_cmp_pkisi_pkifailureinfo_check() returns the state of the bit (0 or 1)
70 with index B<bit_index> in the PKIFailureInfo of the B<si>, or -1 on error.
71
72 ossl_cmp_pkisi_failinfo_get0() returns a direct pointer to the failInfo
73 field contained in B<si>, or NULL on error.
74
75 ossl_cmp_pkisi_statusstring_get0() returns a direct pointer to the statusString
76 field contained in B<si>.
77
78 ossl_pkisi_snprint() places at max B<bufsize> characters of human-readable
79 error string of B<si> in pre-allocated B<buf>. Returns pointer to the same
80 B<buf> containing the string, or NULL on error.
81
82 =head1 NOTES
83
84 CMP is defined in RFC 4210 (and CRMF in RFC 4211).
85
86 =head1 RETURN VALUES
87
88 See the individual functions above.
89
90 =head1 SEE ALSO
91
92 L<OSSL_CMP_CTX_new(3)>, L<ossl_cmp_certreq_new(3)>
93
94 =head1 HISTORY
95
96 The OpenSSL CMP support was added in OpenSSL 3.0.
97
98 =head1 COPYRIGHT
99
100 Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.
101
102 Licensed under the Apache License 2.0 (the "License").  You may not use
103 this file except in compliance with the License.  You can obtain a copy
104 in the file LICENSE in the source distribution or at
105 L<https://www.openssl.org/source/license.html>.
106
107 =cut