nsPK11TokenDB.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #ifndef nsPK11TokenDB_h
  7. #define nsPK11TokenDB_h
  8. #include "nsCOMPtr.h"
  9. #include "nsIPK11Token.h"
  10. #include "nsIPK11TokenDB.h"
  11. #include "nsISupports.h"
  12. #include "nsNSSHelper.h"
  13. #include "nsNSSShutDown.h"
  14. #include "nsString.h"
  15. #include "pk11func.h"
  16. #include "ScopedNSSTypes.h"
  17. class nsPK11Token : public nsIPK11Token,
  18. public nsNSSShutDownObject
  19. {
  20. public:
  21. NS_DECL_ISUPPORTS
  22. NS_DECL_NSIPK11TOKEN
  23. explicit nsPK11Token(PK11SlotInfo *slot);
  24. protected:
  25. virtual ~nsPK11Token();
  26. private:
  27. friend class nsPK11TokenDB;
  28. nsresult refreshTokenInfo(const nsNSSShutDownPreventionLock& proofOfLock);
  29. nsCString mTokenName;
  30. nsCString mTokenLabel;
  31. nsCString mTokenManufacturerID;
  32. nsCString mTokenHWVersion;
  33. nsCString mTokenFWVersion;
  34. nsCString mTokenSerialNum;
  35. mozilla::UniquePK11SlotInfo mSlot;
  36. int mSeries;
  37. nsCOMPtr<nsIInterfaceRequestor> mUIContext;
  38. virtual void virtualDestroyNSSReference() override;
  39. void destructorSafeDestroyNSSReference();
  40. nsresult GetAttributeHelper(const nsACString& attribute,
  41. /*out*/ nsACString& xpcomOutParam);
  42. };
  43. class nsPK11TokenDB : public nsIPK11TokenDB
  44. , public nsNSSShutDownObject
  45. {
  46. public:
  47. NS_DECL_ISUPPORTS
  48. NS_DECL_NSIPK11TOKENDB
  49. nsPK11TokenDB();
  50. protected:
  51. virtual ~nsPK11TokenDB();
  52. // Nothing to release.
  53. virtual void virtualDestroyNSSReference() override {}
  54. };
  55. #define NS_PK11TOKENDB_CID \
  56. { 0xb084a2ce, 0x1dd1, 0x11b2, \
  57. { 0xbf, 0x10, 0x83, 0x24, 0xf8, 0xe0, 0x65, 0xcc }}
  58. #endif // nsPK11TokenDB_h