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"
10 #include "nsIDOMCryptoLegacy.h"
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} }
32 class Crypto
: public nsIDOMCrypto
,
43 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
44 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto
)
47 GetRandomValues(JSContext
* aCx
, const ArrayBufferView
& aArray
,
48 JS::MutableHandle
<JSObject
*> aRetval
,
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
,
70 virtual void ImportUserCertificates(const nsAString
& aNickname
,
71 const nsAString
& aCmmfResponse
,
76 virtual void SignText(JSContext
* aContext
,
77 const nsAString
& aStringToSign
,
78 const nsAString
& aCaOption
,
79 const Sequence
<nsCString
>& aArgs
,
82 virtual void Logout(ErrorResult
& aRv
);
89 GetParentObject() const
95 WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
98 GetRandomValues(uint32_t aLength
);
101 nsCOMPtr
<nsPIDOMWindow
> mWindow
;
102 nsRefPtr
<SubtleCrypto
> mSubtle
;
106 } // namespace mozilla
108 #endif // mozilla_dom_Crypto_h