Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | #ifndef _nsCrypto_h_ |
michael@0 | 7 | #define _nsCrypto_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/dom/BindingDeclarations.h" |
michael@0 | 10 | #include "mozilla/ErrorResult.h" |
michael@0 | 11 | #ifndef MOZ_DISABLE_CRYPTOLEGACY |
michael@0 | 12 | #include "mozilla/dom/NonRefcountedDOMObject.h" |
michael@0 | 13 | #include "Crypto.h" |
michael@0 | 14 | #include "nsCOMPtr.h" |
michael@0 | 15 | #include "nsIDOMCryptoLegacy.h" |
michael@0 | 16 | #include "nsIRunnable.h" |
michael@0 | 17 | #include "nsString.h" |
michael@0 | 18 | #include "nsIPrincipal.h" |
michael@0 | 19 | |
michael@0 | 20 | #define NS_CRYPTO_CID \ |
michael@0 | 21 | {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} } |
michael@0 | 22 | #define PSM_VERSION_STRING "2.4" |
michael@0 | 23 | |
michael@0 | 24 | class nsIPSMComponent; |
michael@0 | 25 | class nsIDOMScriptObjectFactory; |
michael@0 | 26 | |
michael@0 | 27 | namespace mozilla { |
michael@0 | 28 | namespace dom { |
michael@0 | 29 | |
michael@0 | 30 | class CRMFObject : public NonRefcountedDOMObject |
michael@0 | 31 | { |
michael@0 | 32 | public: |
michael@0 | 33 | CRMFObject(); |
michael@0 | 34 | virtual ~CRMFObject(); |
michael@0 | 35 | |
michael@0 | 36 | nsresult SetCRMFRequest(char *inRequest); |
michael@0 | 37 | |
michael@0 | 38 | JSObject* WrapObject(JSContext *aCx, bool* aTookOwnership); |
michael@0 | 39 | |
michael@0 | 40 | void GetRequest(nsAString& aRequest); |
michael@0 | 41 | |
michael@0 | 42 | private: |
michael@0 | 43 | nsString mBase64Request; |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | } |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | class nsCrypto: public mozilla::dom::Crypto |
michael@0 | 50 | { |
michael@0 | 51 | public: |
michael@0 | 52 | nsCrypto(); |
michael@0 | 53 | virtual ~nsCrypto(); |
michael@0 | 54 | |
michael@0 | 55 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 56 | |
michael@0 | 57 | // If legacy DOM crypto is enabled this is the class that actually |
michael@0 | 58 | // implements the legacy methods. |
michael@0 | 59 | NS_DECL_NSIDOMCRYPTO |
michael@0 | 60 | |
michael@0 | 61 | virtual bool EnableSmartCardEvents() MOZ_OVERRIDE; |
michael@0 | 62 | virtual void SetEnableSmartCardEvents(bool aEnable, |
michael@0 | 63 | mozilla::ErrorResult& aRv) MOZ_OVERRIDE; |
michael@0 | 64 | |
michael@0 | 65 | virtual void GetVersion(nsString& aVersion) MOZ_OVERRIDE; |
michael@0 | 66 | |
michael@0 | 67 | virtual mozilla::dom::CRMFObject* |
michael@0 | 68 | GenerateCRMFRequest(JSContext* aContext, |
michael@0 | 69 | const nsCString& aReqDN, |
michael@0 | 70 | const nsCString& aRegToken, |
michael@0 | 71 | const nsCString& aAuthenticator, |
michael@0 | 72 | const nsCString& aEaCert, |
michael@0 | 73 | const nsCString& aJsCallback, |
michael@0 | 74 | const mozilla::dom::Sequence<JS::Value>& aArgs, |
michael@0 | 75 | mozilla::ErrorResult& aRv) MOZ_OVERRIDE; |
michael@0 | 76 | |
michael@0 | 77 | virtual void ImportUserCertificates(const nsAString& aNickname, |
michael@0 | 78 | const nsAString& aCmmfResponse, |
michael@0 | 79 | bool aDoForcedBackup, |
michael@0 | 80 | nsAString& aReturn, |
michael@0 | 81 | mozilla::ErrorResult& aRv) MOZ_OVERRIDE; |
michael@0 | 82 | |
michael@0 | 83 | virtual void SignText(JSContext* aContext, |
michael@0 | 84 | const nsAString& aStringToSign, |
michael@0 | 85 | const nsAString& aCaOption, |
michael@0 | 86 | const mozilla::dom::Sequence<nsCString>& aArgs, |
michael@0 | 87 | nsAString& aReturn) MOZ_OVERRIDE; |
michael@0 | 88 | |
michael@0 | 89 | virtual void Logout(mozilla::ErrorResult& aRv) MOZ_OVERRIDE; |
michael@0 | 90 | |
michael@0 | 91 | private: |
michael@0 | 92 | static already_AddRefed<nsIPrincipal> GetScriptPrincipal(JSContext *cx); |
michael@0 | 93 | |
michael@0 | 94 | bool mEnableSmartCardEvents; |
michael@0 | 95 | }; |
michael@0 | 96 | #endif // MOZ_DISABLE_CRYPTOLEGACY |
michael@0 | 97 | |
michael@0 | 98 | #include "nsIPKCS11.h" |
michael@0 | 99 | |
michael@0 | 100 | #define NS_PKCS11_CID \ |
michael@0 | 101 | {0x74b7a390, 0x3b41, 0x11d4, { 0x8a, 0x80, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} } |
michael@0 | 102 | |
michael@0 | 103 | class nsPkcs11 : public nsIPKCS11 |
michael@0 | 104 | { |
michael@0 | 105 | public: |
michael@0 | 106 | nsPkcs11(); |
michael@0 | 107 | virtual ~nsPkcs11(); |
michael@0 | 108 | |
michael@0 | 109 | NS_DECL_ISUPPORTS |
michael@0 | 110 | NS_DECL_NSIPKCS11 |
michael@0 | 111 | |
michael@0 | 112 | }; |
michael@0 | 113 | |
michael@0 | 114 | #endif //_nsCrypto_h_ |