2
0

ossl_cmp_hdr_init.pod 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. =pod
  2. =head1 NAME
  3. ossl_cmp_hdr_set_pvno,
  4. ossl_cmp_hdr_get_pvno,
  5. ossl_cmp_hdr_get0_sendernonce,
  6. ossl_cmp_hdr_set1_sender,
  7. ossl_cmp_hdr_set1_recipient,
  8. ossl_cmp_hdr_update_messagetime,
  9. ossl_cmp_hdr_set1_senderKID,
  10. ossl_cmp_hdr_push0_freeText,
  11. ossl_cmp_hdr_push1_freeText,
  12. ossl_cmp_hdr_generalinfo_item_push0,
  13. ossl_cmp_hdr_generalinfo_items_push1,
  14. ossl_cmp_hdr_set_implicitConfirm,
  15. ossl_cmp_hdr_check_implicitConfirm,
  16. ossl_cmp_hdr_init
  17. - functions manipulating CMP message headers
  18. =head1 SYNOPSIS
  19. #include "cmp_int.h"
  20. int ossl_cmp_hdr_set_pvno(OSSL_CMP_PKIHEADER *hdr, int pvno);
  21. int ossl_cmp_hdr_get_pvno(const OSSL_CMP_PKIHEADER *hdr);
  22. ASN1_OCTET_STRING
  23. *ossl_cmp_hdr_get0_sendernonce(const OSSL_CMP_PKIHEADER *hdr);
  24. int ossl_cmp_hdr_set1_sender(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm);
  25. int ossl_cmp_hdr_set1_recipient(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm);
  26. int ossl_cmp_hdr_update_messagetime(OSSL_CMP_PKIHEADER *hdr);
  27. int ossl_cmp_hdr_set1_senderKID(OSSL_CMP_PKIHEADER *hdr,
  28. const ASN1_OCTET_STRING *senderKID);
  29. int ossl_cmp_hdr_generalinfo_item_push0(OSSL_CMP_PKIHEADER *hdr,
  30. OSSL_CMP_ITAV *itav);
  31. int ossl_cmp_hdr_generalinfo_items_push1(OSSL_CMP_PKIHEADER *hdr,
  32. STACK_OF(OSSL_CMP_ITAV) *itavs);
  33. int ossl_cmp_hdr_push0_freeText(OSSL_CMP_PKIHEADER *hdr,
  34. ASN1_UTF8STRING *text);
  35. int ossl_cmp_hdr_push1_freeText(OSSL_CMP_PKIHEADER *hdr,
  36. ASN1_UTF8STRING *text);
  37. int ossl_cmp_hdr_set_implicitConfirm(OSSL_CMP_PKIHEADER *hdr);
  38. int ossl_cmp_hdr_check_implicitConfirm(OSSL_CMP_PKIHEADER *hdr);
  39. int ossl_cmp_hdr_init(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr);
  40. =head1 DESCRIPTION
  41. ossl_cmp_hdr_set_pvno() sets hdr->pvno to the given B<pvno>.
  42. ossl_cmp_hdr_get_pvno() returns the pvno of the given B<hdr> or -1 on error.
  43. ossl_cmp_hdr_get0_sendernonce() returns the sender nonce of the given PKIHeader.
  44. ossl_cmp_hdr_set1_sender() sets the sender field in the given PKIHeader
  45. to the given X509 Name value, without consuming the pointer.
  46. ossl_cmp_hdr_set1_recipient() sets the recipient field in the given
  47. PKIHeader to the given X509 Name value, without consuming the pointer.
  48. If B<nm> is NULL, recipient is set to the NULL DN (the empty list of strings).
  49. ossl_cmp_hdr_update_messagetime() (re-)sets the messageTime to the current
  50. system time. As written in RFC 4210, section 5.1.1:
  51. The messageTime field contains the time at which the sender created the message.
  52. This may be useful to allow end entities to correct/check their local time for
  53. consistency with the time on a central system.
  54. ossl_cmp_hdr_set1_senderKID() Sets hdr->senderKID to the given string.
  55. In an PBMAC-protected IR this usually is a reference number issued by the CA,
  56. else the subject key ID of the sender's protecting certificate.
  57. ossl_cmp_hdr_push0_freeText() pushes an ASN1_UTF8STRING to
  58. hdr->freeText and consumes the given pointer.
  59. ossl_cmp_hdr_push1_freeText() pushes an ASN1_UTF8STRING to
  60. hdr->freeText and does not consume the pointer.
  61. ossl_cmp_hdr_generalinfo_item_push0() adds the given InfoTypeAndValue
  62. item to the hdr->generalInfo stack. Consumes the B<itav> pointer.
  63. ossl_cmp_hdr_generalinfo_items_push1() adds a copy of the B<itavs> stack to
  64. the generalInfo field of PKIheader of the B<hdr>. Does not consume the B<itavs>
  65. pointer.
  66. ossl_cmp_hdr_set_implicitConfirm() sets implicitConfirm in the generalInfo field
  67. of the PKIMessage header.
  68. ossl_cmp_hdr_check_implicitConfirm() returns 1 if implicitConfirm is
  69. set int generalInfo field of the given PKIMessage header, 0 if not.
  70. ossl_cmp_hdr_init() initializes a PKIHeader structure based on the
  71. values in the given OSSL_CMP_CTX structure.
  72. This starts a new transaction in case ctx->transactionID is NULL.
  73. The sender name is copied from the subject of the client cert, if any,
  74. or else from the subject name provided for certification requests.
  75. As required by RFC 4210 section 5.1.1., if the sender name is not known
  76. to the client it set to the NULL-DN. In this case for identification at least
  77. the senderKID must be set, which we take from any referenceValue provided.
  78. =head1 NOTES
  79. CMP is defined in RFC 4210 (and CRMF in RFC 4211).
  80. =head1 RETURN VALUES
  81. ossl_cmp_hdr_get_pvno() returns the pvno of the given B<hdr> or -1 on error.
  82. ossl_cmp_hdr_get0_sendernonce() returns the respective nonce.
  83. All other functions return 1 on success, 0 on error.
  84. See the individual functions above.
  85. =head1 HISTORY
  86. The OpenSSL CMP support was added in OpenSSL 3.0.
  87. =head1 COPYRIGHT
  88. Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.
  89. Licensed under the Apache License 2.0 (the "License"). You may not use
  90. this file except in compliance with the License. You can obtain a copy
  91. in the file LICENSE in the source distribution or at
  92. L<https://www.openssl.org/source/license.html>.
  93. =cut