1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/certdb/genname.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,109 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef _GENAME_H_ 1.9 +#define _GENAME_H_ 1.10 + 1.11 +#include "plarena.h" 1.12 +#include "seccomon.h" 1.13 +#include "secoidt.h" 1.14 +#include "secasn1.h" 1.15 +#include "secder.h" 1.16 +#include "certt.h" 1.17 + 1.18 +/************************************************************************/ 1.19 +SEC_BEGIN_PROTOS 1.20 + 1.21 +extern const SEC_ASN1Template CERT_GeneralNamesTemplate[]; 1.22 + 1.23 +extern SECItem ** 1.24 +cert_EncodeGeneralNames(PLArenaPool *arena, CERTGeneralName *names); 1.25 + 1.26 +extern CERTGeneralName * 1.27 +cert_DecodeGeneralNames(PLArenaPool *arena, SECItem **encodedGenName); 1.28 + 1.29 +extern SECStatus 1.30 +cert_DestroyGeneralNames(CERTGeneralName *name); 1.31 + 1.32 +extern CERTGeneralNameType 1.33 +CERT_GetGeneralNameTypeFromString(const char *string); 1.34 + 1.35 +extern SECStatus 1.36 +cert_EncodeNameConstraints(CERTNameConstraints *constraints, PLArenaPool *arena, 1.37 + SECItem *dest); 1.38 + 1.39 +extern CERTNameConstraints * 1.40 +cert_DecodeNameConstraints(PLArenaPool *arena, const SECItem *encodedConstraints); 1.41 + 1.42 +extern CERTGeneralName * 1.43 +cert_CombineNamesLists(CERTGeneralName *list1, CERTGeneralName *list2); 1.44 + 1.45 +extern CERTNameConstraint * 1.46 +cert_CombineConstraintsLists(CERTNameConstraint *list1, CERTNameConstraint *list2); 1.47 + 1.48 +/*********************************************************************/ 1.49 +/* A thread safe implementation of General Names */ 1.50 +/*********************************************************************/ 1.51 + 1.52 +/* Destroy a Single CERTGeneralName */ 1.53 +void 1.54 +CERT_DestroyGeneralName(CERTGeneralName *name); 1.55 + 1.56 +SECStatus 1.57 +CERT_CompareGeneralName(CERTGeneralName *a, CERTGeneralName *b); 1.58 + 1.59 +SECStatus 1.60 +CERT_CopyGeneralName(PLArenaPool *arena, 1.61 + CERTGeneralName *dest, 1.62 + CERTGeneralName *src); 1.63 + 1.64 +/* General Name Lists are a thread safe, reference counting layer to 1.65 + * general names */ 1.66 + 1.67 +/* Destroys a CERTGeneralNameList */ 1.68 +void 1.69 +CERT_DestroyGeneralNameList(CERTGeneralNameList *list); 1.70 + 1.71 +/* Creates a CERTGeneralNameList */ 1.72 +CERTGeneralNameList * 1.73 +CERT_CreateGeneralNameList(CERTGeneralName *name); 1.74 + 1.75 +/* Compares two CERTGeneralNameList */ 1.76 +SECStatus 1.77 +CERT_CompareGeneralNameLists(CERTGeneralNameList *a, CERTGeneralNameList *b); 1.78 + 1.79 +/* returns a copy of the first name of the type requested */ 1.80 +void * 1.81 +CERT_GetGeneralNameFromListByType(CERTGeneralNameList *list, 1.82 + CERTGeneralNameType type, 1.83 + PLArenaPool *arena); 1.84 + 1.85 +/* Adds a name to the tail of the list */ 1.86 +void 1.87 +CERT_AddGeneralNameToList(CERTGeneralNameList *list, 1.88 + CERTGeneralNameType type, 1.89 + void *data, SECItem *oid); 1.90 + 1.91 +/* returns a duplicate of the CERTGeneralNameList */ 1.92 +CERTGeneralNameList * 1.93 +CERT_DupGeneralNameList(CERTGeneralNameList *list); 1.94 + 1.95 +/* returns the number of CERTGeneralName objects in the doubly linked 1.96 +** list of which *names is a member. 1.97 +*/ 1.98 +extern int 1.99 +CERT_GetNamesLength(CERTGeneralName *names); 1.100 + 1.101 +/************************************************************************/ 1.102 + 1.103 +SECStatus 1.104 +CERT_CompareNameSpace(CERTCertificate *cert, 1.105 + CERTGeneralName *namesList, 1.106 + CERTCertificate **certsList, 1.107 + PLArenaPool *reqArena, 1.108 + CERTCertificate **pBadCert); 1.109 + 1.110 +SEC_END_PROTOS 1.111 + 1.112 +#endif