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