Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef _NS_KEYMODULE_H_ |
michael@0 | 6 | #define _NS_KEYMODULE_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include "nsIKeyModule.h" |
michael@0 | 9 | #include "pk11pub.h" |
michael@0 | 10 | #include "mozilla/Attributes.h" |
michael@0 | 11 | |
michael@0 | 12 | /* eae599aa-ecef-49c6-a8af-6ddcc6feb484 */ |
michael@0 | 13 | #define NS_KEYMODULEOBJECT_CID \ |
michael@0 | 14 | { 0xeae599aa, 0xecef, 0x49c6, {0xa8, 0xaf, 0x6d, 0xdc, 0xc6, 0xfe, 0xb4, 0x84} } |
michael@0 | 15 | #define NS_KEYMODULEOBJECT_CONTRACTID "@mozilla.org/security/keyobject;1" |
michael@0 | 16 | |
michael@0 | 17 | /* a39e0e9d-e567-41e3-b12c-5df67f18174d */ |
michael@0 | 18 | #define NS_KEYMODULEOBJECTFACTORY_CID \ |
michael@0 | 19 | { 0xa39e0e9d, 0xe567, 0x41e3, {0xb1, 0x2c, 0x5d, 0xf6, 0x7f, 0x18, 0x17, 0x4d} } |
michael@0 | 20 | #define NS_KEYMODULEOBJECTFACTORY_CONTRACTID \ |
michael@0 | 21 | "@mozilla.org/security/keyobjectfactory;1" |
michael@0 | 22 | |
michael@0 | 23 | class nsKeyObject MOZ_FINAL : public nsIKeyObject |
michael@0 | 24 | { |
michael@0 | 25 | public: |
michael@0 | 26 | nsKeyObject(); |
michael@0 | 27 | |
michael@0 | 28 | NS_DECL_ISUPPORTS |
michael@0 | 29 | NS_DECL_NSIKEYOBJECT |
michael@0 | 30 | |
michael@0 | 31 | private: |
michael@0 | 32 | ~nsKeyObject(); |
michael@0 | 33 | |
michael@0 | 34 | // Disallow copy constructor |
michael@0 | 35 | nsKeyObject(nsKeyObject&); |
michael@0 | 36 | |
michael@0 | 37 | // 0 if not yet set, otherwise one of the nsIKeyObject::*KEY values |
michael@0 | 38 | uint32_t mKeyType; |
michael@0 | 39 | |
michael@0 | 40 | // A union of our possible key types |
michael@0 | 41 | PK11SymKey* mSymKey; |
michael@0 | 42 | SECKEYPrivateKey* mPrivateKey; |
michael@0 | 43 | SECKEYPublicKey* mPublicKey; |
michael@0 | 44 | |
michael@0 | 45 | // Helper method to free memory used by keys. |
michael@0 | 46 | void CleanUp(); |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | |
michael@0 | 50 | class nsKeyObjectFactory MOZ_FINAL : public nsIKeyObjectFactory |
michael@0 | 51 | { |
michael@0 | 52 | public: |
michael@0 | 53 | nsKeyObjectFactory(); |
michael@0 | 54 | |
michael@0 | 55 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 56 | NS_DECL_NSIKEYOBJECTFACTORY |
michael@0 | 57 | |
michael@0 | 58 | private: |
michael@0 | 59 | ~nsKeyObjectFactory() {} |
michael@0 | 60 | |
michael@0 | 61 | // Disallow copy constructor |
michael@0 | 62 | nsKeyObjectFactory(nsKeyObjectFactory&); |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | #endif // _NS_KEYMODULE_H_ |