genname.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef _GENAME_H_
  5. #define _GENAME_H_
  6. #include "plarena.h"
  7. #include "seccomon.h"
  8. #include "secoidt.h"
  9. #include "secasn1.h"
  10. #include "secder.h"
  11. #include "certt.h"
  12. /************************************************************************/
  13. SEC_BEGIN_PROTOS
  14. extern const SEC_ASN1Template CERT_GeneralNamesTemplate[];
  15. extern SECItem **cert_EncodeGeneralNames(PLArenaPool *arena,
  16. CERTGeneralName *names);
  17. extern CERTGeneralName *cert_DecodeGeneralNames(PLArenaPool *arena,
  18. SECItem **encodedGenName);
  19. extern SECStatus cert_DestroyGeneralNames(CERTGeneralName *name);
  20. extern SECStatus cert_EncodeNameConstraints(CERTNameConstraints *constraints,
  21. PLArenaPool *arena, SECItem *dest);
  22. extern CERTNameConstraints *cert_DecodeNameConstraints(
  23. PLArenaPool *arena, const SECItem *encodedConstraints);
  24. extern CERTGeneralName *cert_CombineNamesLists(CERTGeneralName *list1,
  25. CERTGeneralName *list2);
  26. extern CERTNameConstraint *cert_CombineConstraintsLists(
  27. CERTNameConstraint *list1, CERTNameConstraint *list2);
  28. /*********************************************************************/
  29. /* A thread safe implementation of General Names */
  30. /*********************************************************************/
  31. /* Destroy a Single CERTGeneralName */
  32. void CERT_DestroyGeneralName(CERTGeneralName *name);
  33. SECStatus CERT_CompareGeneralName(CERTGeneralName *a, CERTGeneralName *b);
  34. SECStatus CERT_CopyGeneralName(PLArenaPool *arena, CERTGeneralName *dest,
  35. CERTGeneralName *src);
  36. /* General Name Lists are a thread safe, reference counting layer to
  37. * general names */
  38. /* Destroys a CERTGeneralNameList */
  39. void CERT_DestroyGeneralNameList(CERTGeneralNameList *list);
  40. /* Creates a CERTGeneralNameList */
  41. CERTGeneralNameList *CERT_CreateGeneralNameList(CERTGeneralName *name);
  42. /* Compares two CERTGeneralNameList */
  43. SECStatus CERT_CompareGeneralNameLists(CERTGeneralNameList *a,
  44. CERTGeneralNameList *b);
  45. /* returns a copy of the first name of the type requested */
  46. void *CERT_GetGeneralNameFromListByType(CERTGeneralNameList *list,
  47. CERTGeneralNameType type,
  48. PLArenaPool *arena);
  49. /* Adds a name to the tail of the list */
  50. void CERT_AddGeneralNameToList(CERTGeneralNameList *list,
  51. CERTGeneralNameType type, void *data,
  52. SECItem *oid);
  53. /* returns a duplicate of the CERTGeneralNameList */
  54. CERTGeneralNameList *CERT_DupGeneralNameList(CERTGeneralNameList *list);
  55. /* returns the number of CERTGeneralName objects in the doubly linked
  56. ** list of which *names is a member.
  57. */
  58. extern int CERT_GetNamesLength(CERTGeneralName *names);
  59. /************************************************************************/
  60. SECStatus CERT_CompareNameSpace(CERTCertificate *cert,
  61. CERTGeneralName *namesList,
  62. CERTCertificate **certsList,
  63. PLArenaPool *reqArena,
  64. CERTCertificate **pBadCert);
  65. SEC_END_PROTOS
  66. #endif