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 _NS_KEYMODULE_H_ michael@0: #define _NS_KEYMODULE_H_ michael@0: michael@0: #include "nsIKeyModule.h" michael@0: #include "pk11pub.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: /* eae599aa-ecef-49c6-a8af-6ddcc6feb484 */ michael@0: #define NS_KEYMODULEOBJECT_CID \ michael@0: { 0xeae599aa, 0xecef, 0x49c6, {0xa8, 0xaf, 0x6d, 0xdc, 0xc6, 0xfe, 0xb4, 0x84} } michael@0: #define NS_KEYMODULEOBJECT_CONTRACTID "@mozilla.org/security/keyobject;1" michael@0: michael@0: /* a39e0e9d-e567-41e3-b12c-5df67f18174d */ michael@0: #define NS_KEYMODULEOBJECTFACTORY_CID \ michael@0: { 0xa39e0e9d, 0xe567, 0x41e3, {0xb1, 0x2c, 0x5d, 0xf6, 0x7f, 0x18, 0x17, 0x4d} } michael@0: #define NS_KEYMODULEOBJECTFACTORY_CONTRACTID \ michael@0: "@mozilla.org/security/keyobjectfactory;1" michael@0: michael@0: class nsKeyObject MOZ_FINAL : public nsIKeyObject michael@0: { michael@0: public: michael@0: nsKeyObject(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIKEYOBJECT michael@0: michael@0: private: michael@0: ~nsKeyObject(); michael@0: michael@0: // Disallow copy constructor michael@0: nsKeyObject(nsKeyObject&); michael@0: michael@0: // 0 if not yet set, otherwise one of the nsIKeyObject::*KEY values michael@0: uint32_t mKeyType; michael@0: michael@0: // A union of our possible key types michael@0: PK11SymKey* mSymKey; michael@0: SECKEYPrivateKey* mPrivateKey; michael@0: SECKEYPublicKey* mPublicKey; michael@0: michael@0: // Helper method to free memory used by keys. michael@0: void CleanUp(); michael@0: }; michael@0: michael@0: michael@0: class nsKeyObjectFactory MOZ_FINAL : public nsIKeyObjectFactory michael@0: { michael@0: public: michael@0: nsKeyObjectFactory(); michael@0: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIKEYOBJECTFACTORY michael@0: michael@0: private: michael@0: ~nsKeyObjectFactory() {} michael@0: michael@0: // Disallow copy constructor michael@0: nsKeyObjectFactory(nsKeyObjectFactory&); michael@0: }; michael@0: michael@0: #endif // _NS_KEYMODULE_H_