file_parser.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /*############################################################################
  2. # Copyright 2016 Intel Corporation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################*/
  16. /// Epid 1.1 issuer material parsing utilities.
  17. /*!
  18. * \file
  19. */
  20. #ifndef EPID_COMMON_1_1_FILE_PARSER_H_
  21. #define EPID_COMMON_1_1_FILE_PARSER_H_
  22. #include <stddef.h>
  23. #include "epid/common/1.1/types.h"
  24. #include "epid/common/errors.h"
  25. #include "epid/common/file_parser.h"
  26. /// Parser for 1.1 issuer material
  27. /*!
  28. \defgroup Epid11FileParserModule EPID 1.1 support
  29. Defines the APIs needed to parse Intel(R) EPID 1.1 issuer material.
  30. \ingroup FileParser
  31. \see <a href="group___epid11_verifier_module.html#details"><b>EPID 1.1
  32. support</b></a>
  33. @{
  34. */
  35. /// Extracts group public key from buffer in issuer binary format
  36. /*!
  37. Extracts the first group public key from a buffer with format of
  38. Intel(R) EPID 1.1 Group Public Key Certificate Binary File. The
  39. function validates that the first public key was signed by the
  40. private key corresponding to the provided CA certificate and the
  41. size of the input buffer is correct.
  42. \warning
  43. It is the responsibility of the caller to authenticate the
  44. EpidCaCertificate.
  45. \param[in] buf
  46. Pointer to buffer containing public key to extract.
  47. \param[in] len
  48. The size of buf in bytes.
  49. \param[in] cert
  50. The issuing CA public key certificate.
  51. \param[out] pubkey
  52. The extracted group public key.
  53. \returns ::EpidStatus
  54. \retval ::kEpidSigInvalid
  55. Parsing failed due to data authentication failure.
  56. \see <a href="group___epid11_verifier_module.html#details"><b>EPID 1.1
  57. support</b></a>
  58. */
  59. EpidStatus Epid11ParseGroupPubKeyFile(void const* buf, size_t len,
  60. EpidCaCertificate const* cert,
  61. Epid11GroupPubKey* pubkey);
  62. /// Extracts private key revocation list from buffer in issuer binary format
  63. /*!
  64. Extracts the private key revocation list from a buffer with format of
  65. Intel(R) EPID 1.1 Binary Private Key Revocation List File. The function
  66. validates that the revocation list was signed by the private
  67. key corresponding to the provided CA certificate and the size of the
  68. input buffer is correct.
  69. To determine the required size of the revocation list output buffer,
  70. provide a null pointer for the output buffer.
  71. \warning
  72. It is the responsibility of the caller to authenticate the
  73. EpidCaCertificate.
  74. \param[in] buf
  75. Pointer to buffer containing the revocation list to extract.
  76. \param[in] len
  77. The size of buf in bytes.
  78. \param[in] cert
  79. The issuing CA public key certificate.
  80. \param[out] rl
  81. The extracted revocation list. If Null, rl_len is filled with
  82. the required output buffer size.
  83. \param[in,out] rl_len
  84. The size of rl in bytes.
  85. \returns ::EpidStatus
  86. \retval ::kEpidSigInvalid
  87. Parsing failed due to data authentication failure.
  88. \see <a href="group___epid11_verifier_module.html#details"><b>EPID 1.1
  89. support</b></a>
  90. */
  91. EpidStatus Epid11ParsePrivRlFile(void const* buf, size_t len,
  92. EpidCaCertificate const* cert,
  93. Epid11PrivRl* rl, size_t* rl_len);
  94. /// Extracts signature revocation list from buffer in issuer binary format
  95. /*!
  96. Extracts the signature based revocation list from a buffer with
  97. format of Intel(R) EPID 1.1 Binary Signature Revocation List File. The
  98. function
  99. validates that the revocation list was signed by the private key
  100. corresponding to the provided CA certificate and the size of the
  101. input buffer is correct.
  102. To determine the required size of the revocation list output buffer,
  103. provide a null pointer for the output buffer.
  104. \warning
  105. It is the responsibility of the caller to authenticate the
  106. EpidCaCertificate.
  107. \param[in] buf
  108. Pointer to buffer containing the revocation list to extract.
  109. \param[in] len
  110. The size of buf in bytes.
  111. \param[in] cert
  112. The issuing CA public key certificate.
  113. \param[out] rl
  114. The extracted revocation list. If Null, rl_len is filled with
  115. the required output buffer size.
  116. \param[in,out] rl_len
  117. The size of rl in bytes.
  118. \returns ::EpidStatus
  119. \retval ::kEpidSigInvalid
  120. Parsing failed due to data authentication failure.
  121. \see <a href="group___epid11_verifier_module.html#details"><b>EPID 1.1
  122. support</b></a>
  123. */
  124. EpidStatus Epid11ParseSigRlFile(void const* buf, size_t len,
  125. EpidCaCertificate const* cert, Epid11SigRl* rl,
  126. size_t* rl_len);
  127. /// Extracts group revocation list from buffer in issuer binary format
  128. /*!
  129. Extracts the group revocation list from a buffer with format of
  130. Intel(R) EPID 1.1 Binary Group Certificate Revocation List File. The function
  131. validates that the revocation list was signed by the private key
  132. corresponding to the provided CA certificate and the size of the
  133. input buffer is correct.
  134. To determine the required size of the revocation list output buffer,
  135. provide a null pointer for the output buffer.
  136. \warning
  137. It is the responsibility of the caller to authenticate the
  138. EpidCaCertificate.
  139. \param[in] buf
  140. Pointer to buffer containing the revocation list to extract.
  141. \param[in] len
  142. The size of buf in bytes.
  143. \param[in] cert
  144. The issuing CA public key certificate.
  145. \param[out] rl
  146. The extracted revocation list. If Null, rl_len is filled with
  147. the required output buffer size.
  148. \param[in,out] rl_len
  149. The size of rl in bytes.
  150. \returns ::EpidStatus
  151. \retval ::kEpidSigInvalid
  152. Parsing failed due to data authentication failure.
  153. \see <a href="group___epid11_verifier_module.html#details"><b>EPID 1.1
  154. support</b></a>
  155. */
  156. EpidStatus Epid11ParseGroupRlFile(void const* buf, size_t len,
  157. EpidCaCertificate const* cert,
  158. Epid11GroupRl* rl, size_t* rl_len);
  159. /*!
  160. @}
  161. */
  162. #endif // EPID_COMMON_1_1_FILE_PARSER_H_