1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/base/Crypto.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,101 @@ 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 file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 +#ifndef mozilla_dom_Crypto_h 1.8 +#define mozilla_dom_Crypto_h 1.9 + 1.10 +#ifdef MOZ_DISABLE_CRYPTOLEGACY 1.11 +#include "nsIDOMCrypto.h" 1.12 +#else 1.13 +#include "nsIDOMCryptoLegacy.h" 1.14 +namespace mozilla { 1.15 +namespace dom { 1.16 +class CRMFObject; 1.17 +} 1.18 +} 1.19 +#endif 1.20 + 1.21 +#include "nsPIDOMWindow.h" 1.22 + 1.23 +#include "nsWrapperCache.h" 1.24 +#include "mozilla/dom/TypedArray.h" 1.25 +#define NS_DOMCRYPTO_CID \ 1.26 + {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} } 1.27 + 1.28 +namespace mozilla { 1.29 + 1.30 +class ErrorResult; 1.31 + 1.32 +namespace dom { 1.33 + 1.34 +class Crypto : public nsIDOMCrypto, 1.35 + public nsWrapperCache 1.36 +{ 1.37 +public: 1.38 + Crypto(); 1.39 + virtual ~Crypto(); 1.40 + 1.41 + NS_DECL_NSIDOMCRYPTO 1.42 + 1.43 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.44 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto) 1.45 + 1.46 + void 1.47 + GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray, 1.48 + JS::MutableHandle<JSObject*> aRetval, 1.49 + ErrorResult& aRv); 1.50 + 1.51 +#ifndef MOZ_DISABLE_CRYPTOLEGACY 1.52 + virtual bool EnableSmartCardEvents(); 1.53 + virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv); 1.54 + 1.55 + virtual void GetVersion(nsString& aVersion); 1.56 + 1.57 + virtual mozilla::dom::CRMFObject* 1.58 + GenerateCRMFRequest(JSContext* aContext, 1.59 + const nsCString& aReqDN, 1.60 + const nsCString& aRegToken, 1.61 + const nsCString& aAuthenticator, 1.62 + const nsCString& aEaCert, 1.63 + const nsCString& aJsCallback, 1.64 + const Sequence<JS::Value>& aArgs, 1.65 + ErrorResult& aRv); 1.66 + 1.67 + virtual void ImportUserCertificates(const nsAString& aNickname, 1.68 + const nsAString& aCmmfResponse, 1.69 + bool aDoForcedBackup, 1.70 + nsAString& aReturn, 1.71 + ErrorResult& aRv); 1.72 + 1.73 + virtual void SignText(JSContext* aContext, 1.74 + const nsAString& aStringToSign, 1.75 + const nsAString& aCaOption, 1.76 + const Sequence<nsCString>& aArgs, 1.77 + nsAString& aReturn); 1.78 + 1.79 + virtual void Logout(ErrorResult& aRv); 1.80 + 1.81 +#endif 1.82 + 1.83 + // WebIDL 1.84 + 1.85 + nsPIDOMWindow* 1.86 + GetParentObject() const 1.87 + { 1.88 + return mWindow; 1.89 + } 1.90 + 1.91 + virtual JSObject* 1.92 + WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.93 + 1.94 + static uint8_t* 1.95 + GetRandomValues(uint32_t aLength); 1.96 + 1.97 +private: 1.98 + nsCOMPtr<nsPIDOMWindow> mWindow; 1.99 +}; 1.100 + 1.101 +} // namespace dom 1.102 +} // namespace mozilla 1.103 + 1.104 +#endif // mozilla_dom_Crypto_h