1*b077aed3SPierre Pronchery=pod 2*b077aed3SPierre Pronchery 3*b077aed3SPierre Pronchery=head1 NAME 4*b077aed3SPierre Pronchery 5*b077aed3SPierre Proncheryossl_cmp_hdr_set_pvno, 6*b077aed3SPierre Proncheryossl_cmp_hdr_get_pvno, 7*b077aed3SPierre Proncheryossl_cmp_hdr_get_protection_nid, 8*b077aed3SPierre Proncheryossl_cmp_hdr_get0_sendernonce, 9*b077aed3SPierre Proncheryossl_cmp_general_name_is_NULL_DN, 10*b077aed3SPierre Proncheryossl_cmp_hdr_set1_sender, 11*b077aed3SPierre Proncheryossl_cmp_hdr_set1_recipient, 12*b077aed3SPierre Proncheryossl_cmp_hdr_update_messagetime, 13*b077aed3SPierre Proncheryossl_cmp_hdr_set1_senderKID, 14*b077aed3SPierre Proncheryossl_cmp_hdr_push0_freeText, 15*b077aed3SPierre Proncheryossl_cmp_hdr_push1_freeText, 16*b077aed3SPierre Proncheryossl_cmp_hdr_generalinfo_item_push0, 17*b077aed3SPierre Proncheryossl_cmp_hdr_generalinfo_items_push1, 18*b077aed3SPierre Proncheryossl_cmp_hdr_set_implicitConfirm, 19*b077aed3SPierre Proncheryossl_cmp_hdr_has_implicitConfirm, 20*b077aed3SPierre Proncheryossl_cmp_hdr_set_transactionID, 21*b077aed3SPierre Proncheryossl_cmp_hdr_init 22*b077aed3SPierre Pronchery- functions handling CMP message headers 23*b077aed3SPierre Pronchery 24*b077aed3SPierre Pronchery=head1 SYNOPSIS 25*b077aed3SPierre Pronchery 26*b077aed3SPierre Pronchery #include "cmp_local.h" 27*b077aed3SPierre Pronchery 28*b077aed3SPierre Pronchery int ossl_cmp_hdr_set_pvno(OSSL_CMP_PKIHEADER *hdr, int pvno); 29*b077aed3SPierre Pronchery int ossl_cmp_hdr_get_pvno(const OSSL_CMP_PKIHEADER *hdr); 30*b077aed3SPierre Pronchery int ossl_cmp_hdr_get_protection_nid(const OSSL_CMP_PKIHEADER *hdr); 31*b077aed3SPierre Pronchery ASN1_OCTET_STRING 32*b077aed3SPierre Pronchery *ossl_cmp_hdr_get0_sendernonce(const OSSL_CMP_PKIHEADER *hdr); 33*b077aed3SPierre Pronchery int ossl_cmp_general_name_is_NULL_DN(GENERAL_NAME *name); 34*b077aed3SPierre Pronchery 35*b077aed3SPierre Pronchery int ossl_cmp_hdr_set1_sender(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm); 36*b077aed3SPierre Pronchery int ossl_cmp_hdr_set1_recipient(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm); 37*b077aed3SPierre Pronchery int ossl_cmp_hdr_update_messagetime(OSSL_CMP_PKIHEADER *hdr); 38*b077aed3SPierre Pronchery int ossl_cmp_hdr_set1_senderKID(OSSL_CMP_PKIHEADER *hdr, 39*b077aed3SPierre Pronchery const ASN1_OCTET_STRING *senderKID); 40*b077aed3SPierre Pronchery int ossl_cmp_hdr_generalinfo_item_push0(OSSL_CMP_PKIHEADER *hdr, 41*b077aed3SPierre Pronchery OSSL_CMP_ITAV *itav); 42*b077aed3SPierre Pronchery int ossl_cmp_hdr_generalinfo_items_push1(OSSL_CMP_PKIHEADER *hdr, 43*b077aed3SPierre Pronchery STACK_OF(OSSL_CMP_ITAV) *itavs); 44*b077aed3SPierre Pronchery int ossl_cmp_hdr_push0_freeText(OSSL_CMP_PKIHEADER *hdr, 45*b077aed3SPierre Pronchery ASN1_UTF8STRING *text); 46*b077aed3SPierre Pronchery int ossl_cmp_hdr_push1_freeText(OSSL_CMP_PKIHEADER *hdr, 47*b077aed3SPierre Pronchery ASN1_UTF8STRING *text); 48*b077aed3SPierre Pronchery int ossl_cmp_hdr_set_implicitConfirm(OSSL_CMP_PKIHEADER *hdr); 49*b077aed3SPierre Pronchery int ossl_cmp_hdr_has_implicitConfirm(OSSL_CMP_PKIHEADER *hdr); 50*b077aed3SPierre Pronchery int ossl_cmp_hdr_set_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr); 51*b077aed3SPierre Pronchery int ossl_cmp_hdr_init(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr); 52*b077aed3SPierre Pronchery 53*b077aed3SPierre Pronchery=head1 DESCRIPTION 54*b077aed3SPierre Pronchery 55*b077aed3SPierre Proncheryossl_cmp_hdr_set_pvno() sets hdr->pvno to the given B<pvno>. 56*b077aed3SPierre Pronchery 57*b077aed3SPierre Proncheryossl_cmp_hdr_get_pvno() returns the pvno of the given B<hdr> or -1 on error. 58*b077aed3SPierre Pronchery 59*b077aed3SPierre Proncheryossl_cmp_hdr_get_protection_nid returns the NID of the protection algorithm 60*b077aed3SPierre Proncheryin B<hdr> or NID_undef on error. 61*b077aed3SPierre Pronchery 62*b077aed3SPierre Proncheryossl_cmp_hdr_get0_sendernonce() returns the sender nonce of the given PKIHeader. 63*b077aed3SPierre Pronchery 64*b077aed3SPierre Proncheryossl_cmp_general_name_is_NULL_DN() determines if the given GENERAL_NAME 65*b077aed3SPierre Proncheryis the NULL-DN. 66*b077aed3SPierre Pronchery 67*b077aed3SPierre Proncheryossl_cmp_hdr_set1_sender() sets the sender field in the given PKIHeader 68*b077aed3SPierre Proncheryto the given X509 Name value, without consuming the pointer. 69*b077aed3SPierre Pronchery 70*b077aed3SPierre Proncheryossl_cmp_hdr_set1_recipient() sets the recipient field in the given 71*b077aed3SPierre ProncheryPKIHeader to the given X509 Name value, without consuming the pointer. 72*b077aed3SPierre ProncheryIf B<nm> is NULL, recipient is set to the NULL DN (the empty list of strings). 73*b077aed3SPierre Pronchery 74*b077aed3SPierre Proncheryossl_cmp_hdr_update_messagetime() (re-)sets the messageTime to the current 75*b077aed3SPierre Proncherysystem time. As written in RFC 4210, section 5.1.1: 76*b077aed3SPierre ProncheryThe messageTime field contains the time at which the sender created the message. 77*b077aed3SPierre ProncheryThis may be useful to allow end entities to correct/check their local time for 78*b077aed3SPierre Proncheryconsistency with the time on a central system. 79*b077aed3SPierre Pronchery 80*b077aed3SPierre Proncheryossl_cmp_hdr_set1_senderKID() Sets hdr->senderKID to the given string. 81*b077aed3SPierre ProncheryIn an PBMAC-protected IR this usually is a reference number issued by the CA, 82*b077aed3SPierre Proncheryelse the subject key ID of the sender's protecting certificate. 83*b077aed3SPierre Pronchery 84*b077aed3SPierre Proncheryossl_cmp_hdr_push0_freeText() pushes an ASN1_UTF8STRING to 85*b077aed3SPierre Proncheryhdr->freeText and consumes the given pointer. 86*b077aed3SPierre Pronchery 87*b077aed3SPierre Proncheryossl_cmp_hdr_push1_freeText() pushes an ASN1_UTF8STRING to 88*b077aed3SPierre Proncheryhdr->freeText and does not consume the pointer. 89*b077aed3SPierre Pronchery 90*b077aed3SPierre Proncheryossl_cmp_hdr_generalinfo_item_push0() adds the given InfoTypeAndValue 91*b077aed3SPierre Proncheryitem to the hdr->generalInfo stack. Consumes the B<itav> pointer. 92*b077aed3SPierre Pronchery 93*b077aed3SPierre Proncheryossl_cmp_hdr_generalinfo_items_push1() adds a copy of the B<itavs> stack to 94*b077aed3SPierre Proncherythe generalInfo field of PKIheader of the B<hdr>. Does not consume the B<itavs> 95*b077aed3SPierre Proncherypointer. 96*b077aed3SPierre Pronchery 97*b077aed3SPierre Proncheryossl_cmp_hdr_set_implicitConfirm() sets implicitConfirm in the generalInfo field 98*b077aed3SPierre Proncheryof the PKIMessage header. 99*b077aed3SPierre Pronchery 100*b077aed3SPierre Proncheryossl_cmp_hdr_has_implicitConfirm() returns 1 if implicitConfirm is 101*b077aed3SPierre Proncheryset int generalInfo field of the given PKIMessage header, 0 if not. 102*b077aed3SPierre Pronchery 103*b077aed3SPierre Proncheryossl_cmp_hdr_set_transactionID() sets the B<transactionID> field in C<hdr>. 104*b077aed3SPierre ProncheryIn case ctx->transactionID is NULL, it starts a new transaction 105*b077aed3SPierre Proncheryby creating and storing a new random valuee with 128 bits length. 106*b077aed3SPierre Pronchery 107*b077aed3SPierre Proncheryossl_cmp_hdr_init() initializes a PKIHeader structure based on the 108*b077aed3SPierre Proncheryvalues in the given OSSL_CMP_CTX structure. 109*b077aed3SPierre ProncheryThis starts a new transaction in case ctx->transactionID is NULL. 110*b077aed3SPierre ProncheryThe sender name is copied from the subject of the client cert, if any, 111*b077aed3SPierre Proncheryor else from the subject name provided for certification requests. 112*b077aed3SPierre ProncheryAs required by RFC 4210 section 5.1.1., if the sender name is not known 113*b077aed3SPierre Proncheryto the client it set to the NULL-DN. In this case for identification at least 114*b077aed3SPierre Proncherythe senderKID must be set, which we take from any referenceValue provided. 115*b077aed3SPierre Pronchery 116*b077aed3SPierre Pronchery=head1 NOTES 117*b077aed3SPierre Pronchery 118*b077aed3SPierre ProncheryCMP is defined in RFC 4210 (and CRMF in RFC 4211). 119*b077aed3SPierre Pronchery 120*b077aed3SPierre Pronchery=head1 RETURN VALUES 121*b077aed3SPierre Pronchery 122*b077aed3SPierre Proncheryossl_cmp_hdr_get_pvno() returns the pvno of the given B<hdr> or -1 on error. 123*b077aed3SPierre Pronchery 124*b077aed3SPierre Proncheryossl_cmp_hdr_get_protection_nid returns the respective NID, NID_undef on error. 125*b077aed3SPierre Pronchery 126*b077aed3SPierre Proncheryossl_cmp_hdr_get0_sendernonce() returns the respective nonce, or NULL. 127*b077aed3SPierre Pronchery 128*b077aed3SPierre Proncheryossl_cmp_general_name_is_NULL_DN() returns 1 given a NULL-DN, else 0. 129*b077aed3SPierre Pronchery 130*b077aed3SPierre ProncheryAll other functions return 1 on success, 0 on error. 131*b077aed3SPierre Pronchery 132*b077aed3SPierre ProncherySee the individual functions above. 133*b077aed3SPierre Pronchery 134*b077aed3SPierre Pronchery=head1 SEE ALSO 135*b077aed3SPierre Pronchery 136*b077aed3SPierre ProncheryL<ossl_cmp_msg_create(3)> 137*b077aed3SPierre Pronchery 138*b077aed3SPierre Pronchery=head1 HISTORY 139*b077aed3SPierre Pronchery 140*b077aed3SPierre ProncheryThe OpenSSL CMP support was added in OpenSSL 3.0. 141*b077aed3SPierre Pronchery 142*b077aed3SPierre Pronchery=head1 COPYRIGHT 143*b077aed3SPierre Pronchery 144*b077aed3SPierre ProncheryCopyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved. 145*b077aed3SPierre Pronchery 146*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 147*b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 148*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 149*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 150*b077aed3SPierre Pronchery 151*b077aed3SPierre Pronchery=cut 152