Bumping manifests a=b2g-bump
[gecko.git] / dom / base / Crypto.h
blobdd2c204940bf0ba44b46f0f15ae5259f195ea350
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
7 #ifdef MOZ_DISABLE_CRYPTOLEGACY
8 #include "nsIDOMCrypto.h"
9 #else
10 #include "nsIDOMCryptoLegacy.h"
11 namespace mozilla {
12 namespace dom {
13 class CRMFObject;
16 #endif
18 #include "mozilla/dom/SubtleCrypto.h"
19 #include "nsPIDOMWindow.h"
21 #include "nsWrapperCache.h"
22 #include "mozilla/dom/TypedArray.h"
23 #define NS_DOMCRYPTO_CID \
24 {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
26 namespace mozilla {
28 class ErrorResult;
30 namespace dom {
32 class Crypto : public nsIDOMCrypto,
33 public nsWrapperCache
35 protected:
36 virtual ~Crypto();
38 public:
39 Crypto();
41 NS_DECL_NSIDOMCRYPTO
43 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
44 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto)
46 void
47 GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
48 JS::MutableHandle<JSObject*> aRetval,
49 ErrorResult& aRv);
51 SubtleCrypto*
52 Subtle();
54 #ifndef MOZ_DISABLE_CRYPTOLEGACY
55 virtual bool EnableSmartCardEvents();
56 virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv);
58 virtual void GetVersion(nsString& aVersion);
60 virtual mozilla::dom::CRMFObject*
61 GenerateCRMFRequest(JSContext* aContext,
62 const nsCString& aReqDN,
63 const nsCString& aRegToken,
64 const nsCString& aAuthenticator,
65 const nsCString& aEaCert,
66 const nsCString& aJsCallback,
67 const Sequence<JS::Value>& aArgs,
68 ErrorResult& aRv);
70 virtual void ImportUserCertificates(const nsAString& aNickname,
71 const nsAString& aCmmfResponse,
72 bool aDoForcedBackup,
73 nsAString& aReturn,
74 ErrorResult& aRv);
76 virtual void SignText(JSContext* aContext,
77 const nsAString& aStringToSign,
78 const nsAString& aCaOption,
79 const Sequence<nsCString>& aArgs,
80 nsAString& aReturn);
82 virtual void Logout(ErrorResult& aRv);
84 #endif
86 // WebIDL
88 nsPIDOMWindow*
89 GetParentObject() const
91 return mWindow;
94 virtual JSObject*
95 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
97 static uint8_t*
98 GetRandomValues(uint32_t aLength);
100 private:
101 nsCOMPtr<nsPIDOMWindow> mWindow;
102 nsRefPtr<SubtleCrypto> mSubtle;
105 } // namespace dom
106 } // namespace mozilla
108 #endif // mozilla_dom_Crypto_h