1e1051a39Sopenharmony_ci=pod 2e1051a39Sopenharmony_ci 3e1051a39Sopenharmony_ci=head1 NAME 4e1051a39Sopenharmony_ci 5e1051a39Sopenharmony_ciossl_cmp_certreq_new, 6e1051a39Sopenharmony_ciossl_cmp_certrep_new, 7e1051a39Sopenharmony_ciossl_cmp_rr_new, 8e1051a39Sopenharmony_ciossl_cmp_rp_new, 9e1051a39Sopenharmony_ciossl_cmp_certConf_new, 10e1051a39Sopenharmony_ciossl_cmp_pkiconf_new, 11e1051a39Sopenharmony_ciossl_cmp_pollReq_new, 12e1051a39Sopenharmony_ciossl_cmp_pollRep_new, 13e1051a39Sopenharmony_ciossl_cmp_genm_new, 14e1051a39Sopenharmony_ciossl_cmp_genp_new, 15e1051a39Sopenharmony_ciossl_cmp_error_new 16e1051a39Sopenharmony_ci- functions for generating CMP messages 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_ci=head1 SYNOPSIS 19e1051a39Sopenharmony_ci 20e1051a39Sopenharmony_ci #include "cmp_local.h" 21e1051a39Sopenharmony_ci 22e1051a39Sopenharmony_ci OSSL_ossl_cmp_MSG *ossl_cmp_certreq_new(OSSL_CMP_CTX *ctx, int bodytype, 23e1051a39Sopenharmony_ci const OSSL_CRMF_MSG *crm); 24e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_certrep_new(OSSL_CMP_CTX *ctx, int bodytype, 25e1051a39Sopenharmony_ci int certReqId, const OSSL_CMP_PKISI *si, 26e1051a39Sopenharmony_ci X509 *cert, const X509 *encryption_recip, 27e1051a39Sopenharmony_ci STACK_OF(X509) *chain, STACK_OF(X509) *caPubs, 28e1051a39Sopenharmony_ci int unprotectedErrors); 29e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_rr_new(OSSL_CMP_CTX *ctx); 30e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_rp_new(OSSL_CMP_CTX *ctx, const OSSL_CMP_PKISI *si, 31e1051a39Sopenharmony_ci const OSSL_CRMF_CERTID *cid, 32e1051a39Sopenharmony_ci int unprotectedErrors); 33e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_certConf_new(OSSL_CMP_CTX *ctx, int certReqId, 34e1051a39Sopenharmony_ci int fail_info, const char *text); 35e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_pkiconf_new(OSSL_CMP_CTX *ctx); 36e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_pollReq_new(OSSL_CMP_CTX *ctx, int crid); 37e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_pollRep_new(OSSL_CMP_CTX *ctx, int crid, int poll_after); 38e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_genm_new(OSSL_CMP_CTX *ctx); 39e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_genp_new(OSSL_CMP_CTX *ctx); 40e1051a39Sopenharmony_ci OSSL_CMP_MSG *ossl_cmp_error_new(OSSL_CMP_CTX *ctx, const OSSL_CMP_PKISI *si, 41e1051a39Sopenharmony_ci int64_t errorCode, const char *details, 42e1051a39Sopenharmony_ci int unprotected); 43e1051a39Sopenharmony_ci 44e1051a39Sopenharmony_ci=head1 DESCRIPTION 45e1051a39Sopenharmony_ci 46e1051a39Sopenharmony_ciThis is the internal API for creating various CMP PKIMESSAGES. 47e1051a39Sopenharmony_ciAll functions are based on L<ossl_cmp_msg_create(3)>. 48e1051a39Sopenharmony_ciThe allocate a new message, fill it with the relevant data derived from 49e1051a39Sopenharmony_cithe given B<OSSL_CMP_CTX>, and create the applicable protection. 50e1051a39Sopenharmony_ci 51e1051a39Sopenharmony_ciossl_cmp_certreq_new() creates a PKIMessage for requesting a certificate, 52e1051a39Sopenharmony_ciwhich can be either of IR/CR/KUR/P10CR, depending on the given I<bodytype>. 53e1051a39Sopenharmony_ciThe CRMF message to use may be given explicitly via a non-NULL I<crm> argument, 54e1051a39Sopenharmony_ciotherwise it is created from the information in the I<ctx>. 55e1051a39Sopenharmony_ci 56e1051a39Sopenharmony_ciAvailable CMP certificate request PKIMessage I<bodytype>s are: 57e1051a39Sopenharmony_ci 58e1051a39Sopenharmony_ci=over 4 59e1051a39Sopenharmony_ci 60e1051a39Sopenharmony_ci=item * B<OSSL_CMP_PKIBODY_IR> - Initialization Request 61e1051a39Sopenharmony_ci 62e1051a39Sopenharmony_ci=item * B<OSSL_CMP_PKIBODY_CR> - Certification Request 63e1051a39Sopenharmony_ci 64e1051a39Sopenharmony_ci=item * B<OSSL_CMP_PKIBODY_P10CR> - PKCS#10 Certification Request 65e1051a39Sopenharmony_ci 66e1051a39Sopenharmony_ci=item * B<OSSL_CMP_PKIBODY_KUR> - Key Update Request 67e1051a39Sopenharmony_ci 68e1051a39Sopenharmony_ci=back 69e1051a39Sopenharmony_ci 70e1051a39Sopenharmony_ciossl_cmp_certrep_new() creates a PKIMessage for certificate response, 71e1051a39Sopenharmony_ciwhich can be either of IP/CP/KUP, depending on the given I<bodytype>, 72e1051a39Sopenharmony_ciwith the given I<certReqId> and I<si> values and optionally with I<cert>, 73e1051a39Sopenharmony_ciI<chain>, and I<caPubs>. The I<cert>, I<chain>, and I<caPubs> arguments 74e1051a39Sopenharmony_ciare not consumed if present but their internal reference counter is increased. 75e1051a39Sopenharmony_ciThe I<encryption_recip> is currently unsupported. 76e1051a39Sopenharmony_ciThe function does not protect the message if the B<status> value in I<si> 77e1051a39Sopenharmony_ciis B<rejected> and I<unprotectedErrors> is nonzero. 78e1051a39Sopenharmony_ci 79e1051a39Sopenharmony_ciAvailable CMP certificate response PKIMessage I<bodytype>s are: 80e1051a39Sopenharmony_ci 81e1051a39Sopenharmony_ci=over 4 82e1051a39Sopenharmony_ci 83e1051a39Sopenharmony_ci=item * B<OSSL_CMP_PKIBODY_IP> - Initialization Response 84e1051a39Sopenharmony_ci 85e1051a39Sopenharmony_ci=item * B<OSSL_CMP_PKIBODY_CP> - Certification Response 86e1051a39Sopenharmony_ci 87e1051a39Sopenharmony_ci=item * B<OSSL_CMP_PKIBODY_KUP> - Key Update Response 88e1051a39Sopenharmony_ci 89e1051a39Sopenharmony_ci=back 90e1051a39Sopenharmony_ci 91e1051a39Sopenharmony_ciThe list of all CMP PKIMessage I<bodytype>s is: 92e1051a39Sopenharmony_ci 93e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_IR 0 94e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_IP 1 95e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CR 2 96e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CP 3 97e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_P10CR 4 98e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_POPDECC 5 99e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_POPDECR 6 100e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_KRR 9 101e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_KRP 10 102e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_RR 11 103e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_RP 12 104e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CCR 13 105e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CCP 14 106e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CKUANN 15 107e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CANN 16 108e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_RANN 17 109e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CRLANN 18 110e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_PKICONF 19 111e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_NESTED 20 112e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_GENM 21 113e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_GENP 22 114e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_ERROR 23 115e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_CERTCONF 24 116e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_POLLREQ 25 117e1051a39Sopenharmony_ci #define OSSL_CMP_PKIBODY_POLLREP 26 118e1051a39Sopenharmony_ci 119e1051a39Sopenharmony_ciossl_cmp_rr_new() creates a Revocation Request message from the 120e1051a39Sopenharmony_ciinformation set via OSSL_CMP_CTX_set1_oldClCert(). 121e1051a39Sopenharmony_ci 122e1051a39Sopenharmony_ciossl_cmp_rp_new() creates a Revocation Response message with I<si> and I<cid>. 123e1051a39Sopenharmony_ciIt does not protect the message if the B<status> value in I<si> is B<rejected> 124e1051a39Sopenharmony_ciand I<unprotectedErrors> is nonzero. 125e1051a39Sopenharmony_ci 126e1051a39Sopenharmony_ciossl_cmp_certConf_new() creates a Certificate Confirmation message for the last 127e1051a39Sopenharmony_cireceived certificate with the given I<certReqId>. 128e1051a39Sopenharmony_ciThe PKIStatus defaults to B<accepted> if the I<fail_info> bit field is 0. 129e1051a39Sopenharmony_ciOtherwise it is taken as the failInfo of the PKIStatusInfo, PKIStatus is 130e1051a39Sopenharmony_ciset to B<rejected>, and I<text> is copied to statusString unless it is NULL. 131e1051a39Sopenharmony_ci 132e1051a39Sopenharmony_ciossl_cmp_pkiconf_new() creates a PKI Confirmation message. 133e1051a39Sopenharmony_ci 134e1051a39Sopenharmony_ciossl_cmp_pollReq_new() creates a Polling Request message with certReqId set to 135e1051a39Sopenharmony_ciI<crid>. 136e1051a39Sopenharmony_ci 137e1051a39Sopenharmony_ciossl_cmp_pollRep_new() creates a Polling Response message with certReqId set to 138e1051a39Sopenharmony_ciI<crid> and pollAfter to I<poll_after>. 139e1051a39Sopenharmony_ci 140e1051a39Sopenharmony_ciossl_cmp_genm_new() creates a new General Message with an empty ITAV stack. 141e1051a39Sopenharmony_ci 142e1051a39Sopenharmony_ciossl_cmp_genp_new() creates a new General Response with an empty ITAV stack. 143e1051a39Sopenharmony_ci 144e1051a39Sopenharmony_ciossl_cmp_error_new() creates a new Error Message with the given contents 145e1051a39Sopenharmony_ciI<si>, I<errorCode>, and optional I<details>. 146e1051a39Sopenharmony_ciIf I<errorCode> is positive and in the range of an OpenSSL error code, 147e1051a39Sopenharmony_cithe library and reason strings are included in the B<errorDetails> field. 148e1051a39Sopenharmony_ciIf given, the I<details> are added to the contents of the B<errorDetails> field. 149e1051a39Sopenharmony_ciThe function does not protect the message if I<unprotectedErrors> is nonzero. 150e1051a39Sopenharmony_ci 151e1051a39Sopenharmony_ci=head1 NOTES 152e1051a39Sopenharmony_ci 153e1051a39Sopenharmony_ciCMP is specified in RFC 4210 (and CRMF in RFC 4211). 154e1051a39Sopenharmony_ci 155e1051a39Sopenharmony_ci=head1 RETURN VALUES 156e1051a39Sopenharmony_ci 157e1051a39Sopenharmony_ciAll of the functions return a new OSSL_CMP_MSG structure containing 158e1051a39Sopenharmony_cithe generated message on success, or NULL on error. 159e1051a39Sopenharmony_ci 160e1051a39Sopenharmony_ci=head1 SEE ALSO 161e1051a39Sopenharmony_ci 162e1051a39Sopenharmony_ciL<ossl_cmp_msg_create(3)>, 163e1051a39Sopenharmony_ciL<OSSL_CMP_CTX_new(3)>, L<ERR_load_strings(3)> 164e1051a39Sopenharmony_ci 165e1051a39Sopenharmony_ci=head1 HISTORY 166e1051a39Sopenharmony_ci 167e1051a39Sopenharmony_ciThe OpenSSL CMP support was added in OpenSSL 3.0. 168e1051a39Sopenharmony_ci 169e1051a39Sopenharmony_ci=head1 COPYRIGHT 170e1051a39Sopenharmony_ci 171e1051a39Sopenharmony_ciCopyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved. 172e1051a39Sopenharmony_ci 173e1051a39Sopenharmony_ciLicensed under the Apache License 2.0 (the "License"). You may not use 174e1051a39Sopenharmony_cithis file except in compliance with the License. You can obtain a copy 175e1051a39Sopenharmony_ciin the file LICENSE in the source distribution or at 176e1051a39Sopenharmony_ciL<https://www.openssl.org/source/license.html>. 177e1051a39Sopenharmony_ci 178e1051a39Sopenharmony_ci=cut 179