dom/base/Crypto.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:a85f61cab8d1
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 file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 #ifndef mozilla_dom_Crypto_h
5 #define mozilla_dom_Crypto_h
6
7 #ifdef MOZ_DISABLE_CRYPTOLEGACY
8 #include "nsIDOMCrypto.h"
9 #else
10 #include "nsIDOMCryptoLegacy.h"
11 namespace mozilla {
12 namespace dom {
13 class CRMFObject;
14 }
15 }
16 #endif
17
18 #include "nsPIDOMWindow.h"
19
20 #include "nsWrapperCache.h"
21 #include "mozilla/dom/TypedArray.h"
22 #define NS_DOMCRYPTO_CID \
23 {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
24
25 namespace mozilla {
26
27 class ErrorResult;
28
29 namespace dom {
30
31 class Crypto : public nsIDOMCrypto,
32 public nsWrapperCache
33 {
34 public:
35 Crypto();
36 virtual ~Crypto();
37
38 NS_DECL_NSIDOMCRYPTO
39
40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
41 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto)
42
43 void
44 GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
45 JS::MutableHandle<JSObject*> aRetval,
46 ErrorResult& aRv);
47
48 #ifndef MOZ_DISABLE_CRYPTOLEGACY
49 virtual bool EnableSmartCardEvents();
50 virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv);
51
52 virtual void GetVersion(nsString& aVersion);
53
54 virtual mozilla::dom::CRMFObject*
55 GenerateCRMFRequest(JSContext* aContext,
56 const nsCString& aReqDN,
57 const nsCString& aRegToken,
58 const nsCString& aAuthenticator,
59 const nsCString& aEaCert,
60 const nsCString& aJsCallback,
61 const Sequence<JS::Value>& aArgs,
62 ErrorResult& aRv);
63
64 virtual void ImportUserCertificates(const nsAString& aNickname,
65 const nsAString& aCmmfResponse,
66 bool aDoForcedBackup,
67 nsAString& aReturn,
68 ErrorResult& aRv);
69
70 virtual void SignText(JSContext* aContext,
71 const nsAString& aStringToSign,
72 const nsAString& aCaOption,
73 const Sequence<nsCString>& aArgs,
74 nsAString& aReturn);
75
76 virtual void Logout(ErrorResult& aRv);
77
78 #endif
79
80 // WebIDL
81
82 nsPIDOMWindow*
83 GetParentObject() const
84 {
85 return mWindow;
86 }
87
88 virtual JSObject*
89 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
90
91 static uint8_t*
92 GetRandomValues(uint32_t aLength);
93
94 private:
95 nsCOMPtr<nsPIDOMWindow> mWindow;
96 };
97
98 } // namespace dom
99 } // namespace mozilla
100
101 #endif // mozilla_dom_Crypto_h

mercurial