ossl_cmp_hdr_init.pod 5.7 KB

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