michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _GENAME_H_ michael@0: #define _GENAME_H_ michael@0: michael@0: #include "plarena.h" michael@0: #include "seccomon.h" michael@0: #include "secoidt.h" michael@0: #include "secasn1.h" michael@0: #include "secder.h" michael@0: #include "certt.h" michael@0: michael@0: /************************************************************************/ michael@0: SEC_BEGIN_PROTOS michael@0: michael@0: extern const SEC_ASN1Template CERT_GeneralNamesTemplate[]; michael@0: michael@0: extern SECItem ** michael@0: cert_EncodeGeneralNames(PLArenaPool *arena, CERTGeneralName *names); michael@0: michael@0: extern CERTGeneralName * michael@0: cert_DecodeGeneralNames(PLArenaPool *arena, SECItem **encodedGenName); michael@0: michael@0: extern SECStatus michael@0: cert_DestroyGeneralNames(CERTGeneralName *name); michael@0: michael@0: extern CERTGeneralNameType michael@0: CERT_GetGeneralNameTypeFromString(const char *string); michael@0: michael@0: extern SECStatus michael@0: cert_EncodeNameConstraints(CERTNameConstraints *constraints, PLArenaPool *arena, michael@0: SECItem *dest); michael@0: michael@0: extern CERTNameConstraints * michael@0: cert_DecodeNameConstraints(PLArenaPool *arena, const SECItem *encodedConstraints); michael@0: michael@0: extern CERTGeneralName * michael@0: cert_CombineNamesLists(CERTGeneralName *list1, CERTGeneralName *list2); michael@0: michael@0: extern CERTNameConstraint * michael@0: cert_CombineConstraintsLists(CERTNameConstraint *list1, CERTNameConstraint *list2); michael@0: michael@0: /*********************************************************************/ michael@0: /* A thread safe implementation of General Names */ michael@0: /*********************************************************************/ michael@0: michael@0: /* Destroy a Single CERTGeneralName */ michael@0: void michael@0: CERT_DestroyGeneralName(CERTGeneralName *name); michael@0: michael@0: SECStatus michael@0: CERT_CompareGeneralName(CERTGeneralName *a, CERTGeneralName *b); michael@0: michael@0: SECStatus michael@0: CERT_CopyGeneralName(PLArenaPool *arena, michael@0: CERTGeneralName *dest, michael@0: CERTGeneralName *src); michael@0: michael@0: /* General Name Lists are a thread safe, reference counting layer to michael@0: * general names */ michael@0: michael@0: /* Destroys a CERTGeneralNameList */ michael@0: void michael@0: CERT_DestroyGeneralNameList(CERTGeneralNameList *list); michael@0: michael@0: /* Creates a CERTGeneralNameList */ michael@0: CERTGeneralNameList * michael@0: CERT_CreateGeneralNameList(CERTGeneralName *name); michael@0: michael@0: /* Compares two CERTGeneralNameList */ michael@0: SECStatus michael@0: CERT_CompareGeneralNameLists(CERTGeneralNameList *a, CERTGeneralNameList *b); michael@0: michael@0: /* returns a copy of the first name of the type requested */ michael@0: void * michael@0: CERT_GetGeneralNameFromListByType(CERTGeneralNameList *list, michael@0: CERTGeneralNameType type, michael@0: PLArenaPool *arena); michael@0: michael@0: /* Adds a name to the tail of the list */ michael@0: void michael@0: CERT_AddGeneralNameToList(CERTGeneralNameList *list, michael@0: CERTGeneralNameType type, michael@0: void *data, SECItem *oid); michael@0: michael@0: /* returns a duplicate of the CERTGeneralNameList */ michael@0: CERTGeneralNameList * michael@0: CERT_DupGeneralNameList(CERTGeneralNameList *list); michael@0: michael@0: /* returns the number of CERTGeneralName objects in the doubly linked michael@0: ** list of which *names is a member. michael@0: */ michael@0: extern int michael@0: CERT_GetNamesLength(CERTGeneralName *names); michael@0: michael@0: /************************************************************************/ michael@0: michael@0: SECStatus michael@0: CERT_CompareNameSpace(CERTCertificate *cert, michael@0: CERTGeneralName *namesList, michael@0: CERTCertificate **certsList, michael@0: PLArenaPool *reqArena, michael@0: CERTCertificate **pBadCert); michael@0: michael@0: SEC_END_PROTOS michael@0: michael@0: #endif