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 PKISTORE_H michael@0: #define PKISTORE_H michael@0: michael@0: #ifndef NSSPKIT_H michael@0: #include "nsspkit.h" michael@0: #endif /* NSSPKIT_H */ michael@0: michael@0: #ifndef BASE_H michael@0: #include "base.h" michael@0: #endif /* BASE_H */ michael@0: michael@0: PR_BEGIN_EXTERN_C michael@0: michael@0: /* michael@0: * PKI Stores michael@0: * michael@0: * This is a set of routines for managing local stores of PKI objects. michael@0: * Currently, the only application is in crypto contexts, where the michael@0: * certificate store is used. In the future, methods should be added michael@0: * here for storing local references to keys. michael@0: */ michael@0: michael@0: /* michael@0: * nssCertificateStore michael@0: * michael@0: * Manages local store of certificate, trust, and S/MIME profile objects. michael@0: * Within a crypto context, mappings of cert to trust and cert to S/MIME michael@0: * profile are always 1-1. Therefore, it is reasonable to store all objects michael@0: * in a single collection, indexed by the certificate. michael@0: */ michael@0: michael@0: NSS_EXTERN nssCertificateStore * michael@0: nssCertificateStore_Create michael@0: ( michael@0: NSSArena *arenaOpt michael@0: ); michael@0: michael@0: NSS_EXTERN PRStatus michael@0: nssCertificateStore_Destroy michael@0: ( michael@0: nssCertificateStore *store michael@0: ); michael@0: michael@0: /* Atomic Find cert in store, or add this cert to the store. michael@0: ** Ref counts properly maintained. michael@0: */ michael@0: NSS_EXTERN NSSCertificate * michael@0: nssCertificateStore_FindOrAdd michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSCertificate *c michael@0: ); michael@0: michael@0: NSS_EXTERN void michael@0: nssCertificateStore_RemoveCertLOCKED michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSCertificate *cert michael@0: ); michael@0: michael@0: struct nssCertificateStoreTraceStr { michael@0: nssCertificateStore* store; michael@0: PZLock* lock; michael@0: PRBool locked; michael@0: PRBool unlocked; michael@0: }; michael@0: michael@0: typedef struct nssCertificateStoreTraceStr nssCertificateStoreTrace; michael@0: michael@0: NSS_EXTERN void michael@0: nssCertificateStore_Lock ( michael@0: nssCertificateStore *store, nssCertificateStoreTrace* out michael@0: ); michael@0: michael@0: NSS_EXTERN void michael@0: nssCertificateStore_Unlock ( michael@0: nssCertificateStore *store, const nssCertificateStoreTrace* in, michael@0: nssCertificateStoreTrace* out michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCertificate ** michael@0: nssCertificateStore_FindCertificatesBySubject michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSDER *subject, michael@0: NSSCertificate *rvOpt[], michael@0: PRUint32 maximumOpt, michael@0: NSSArena *arenaOpt michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCertificate ** michael@0: nssCertificateStore_FindCertificatesByNickname michael@0: ( michael@0: nssCertificateStore *store, michael@0: const NSSUTF8 *nickname, michael@0: NSSCertificate *rvOpt[], michael@0: PRUint32 maximumOpt, michael@0: NSSArena *arenaOpt michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCertificate ** michael@0: nssCertificateStore_FindCertificatesByEmail michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSASCII7 *email, michael@0: NSSCertificate *rvOpt[], michael@0: PRUint32 maximumOpt, michael@0: NSSArena *arenaOpt michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCertificate * michael@0: nssCertificateStore_FindCertificateByIssuerAndSerialNumber michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSDER *issuer, michael@0: NSSDER *serial michael@0: ); michael@0: michael@0: NSS_EXTERN NSSCertificate * michael@0: nssCertificateStore_FindCertificateByEncodedCertificate michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSDER *encoding michael@0: ); michael@0: michael@0: NSS_EXTERN PRStatus michael@0: nssCertificateStore_AddTrust michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSTrust *trust michael@0: ); michael@0: michael@0: NSS_EXTERN NSSTrust * michael@0: nssCertificateStore_FindTrustForCertificate michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSCertificate *cert michael@0: ); michael@0: michael@0: NSS_EXTERN PRStatus michael@0: nssCertificateStore_AddSMIMEProfile michael@0: ( michael@0: nssCertificateStore *store, michael@0: nssSMIMEProfile *profile michael@0: ); michael@0: michael@0: NSS_EXTERN nssSMIMEProfile * michael@0: nssCertificateStore_FindSMIMEProfileForCertificate michael@0: ( michael@0: nssCertificateStore *store, michael@0: NSSCertificate *cert michael@0: ); michael@0: michael@0: NSS_EXTERN void michael@0: nssCertificateStore_DumpStoreInfo michael@0: ( michael@0: nssCertificateStore *store, michael@0: void (* cert_dump_iter)(const void *, void *, void *), michael@0: void *arg michael@0: ); michael@0: michael@0: PR_END_EXTERN_C michael@0: michael@0: #endif /* PKISTORE_H */