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