1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsKeyModule.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef _NS_KEYMODULE_H_ 1.9 +#define _NS_KEYMODULE_H_ 1.10 + 1.11 +#include "nsIKeyModule.h" 1.12 +#include "pk11pub.h" 1.13 +#include "mozilla/Attributes.h" 1.14 + 1.15 +/* eae599aa-ecef-49c6-a8af-6ddcc6feb484 */ 1.16 +#define NS_KEYMODULEOBJECT_CID \ 1.17 +{ 0xeae599aa, 0xecef, 0x49c6, {0xa8, 0xaf, 0x6d, 0xdc, 0xc6, 0xfe, 0xb4, 0x84} } 1.18 +#define NS_KEYMODULEOBJECT_CONTRACTID "@mozilla.org/security/keyobject;1" 1.19 + 1.20 +/* a39e0e9d-e567-41e3-b12c-5df67f18174d */ 1.21 +#define NS_KEYMODULEOBJECTFACTORY_CID \ 1.22 +{ 0xa39e0e9d, 0xe567, 0x41e3, {0xb1, 0x2c, 0x5d, 0xf6, 0x7f, 0x18, 0x17, 0x4d} } 1.23 +#define NS_KEYMODULEOBJECTFACTORY_CONTRACTID \ 1.24 +"@mozilla.org/security/keyobjectfactory;1" 1.25 + 1.26 +class nsKeyObject MOZ_FINAL : public nsIKeyObject 1.27 +{ 1.28 +public: 1.29 + nsKeyObject(); 1.30 + 1.31 + NS_DECL_ISUPPORTS 1.32 + NS_DECL_NSIKEYOBJECT 1.33 + 1.34 +private: 1.35 + ~nsKeyObject(); 1.36 + 1.37 + // Disallow copy constructor 1.38 + nsKeyObject(nsKeyObject&); 1.39 + 1.40 + // 0 if not yet set, otherwise one of the nsIKeyObject::*KEY values 1.41 + uint32_t mKeyType; 1.42 + 1.43 + // A union of our possible key types 1.44 + PK11SymKey* mSymKey; 1.45 + SECKEYPrivateKey* mPrivateKey; 1.46 + SECKEYPublicKey* mPublicKey; 1.47 + 1.48 + // Helper method to free memory used by keys. 1.49 + void CleanUp(); 1.50 +}; 1.51 + 1.52 + 1.53 +class nsKeyObjectFactory MOZ_FINAL : public nsIKeyObjectFactory 1.54 +{ 1.55 +public: 1.56 + nsKeyObjectFactory(); 1.57 + 1.58 + NS_DECL_THREADSAFE_ISUPPORTS 1.59 + NS_DECL_NSIKEYOBJECTFACTORY 1.60 + 1.61 +private: 1.62 + ~nsKeyObjectFactory() {} 1.63 + 1.64 + // Disallow copy constructor 1.65 + nsKeyObjectFactory(nsKeyObjectFactory&); 1.66 +}; 1.67 + 1.68 +#endif // _NS_KEYMODULE_H_