michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef _nsCrypto_h_ michael@0: #define _nsCrypto_h_ michael@0: michael@0: #include "mozilla/dom/BindingDeclarations.h" michael@0: #include "mozilla/ErrorResult.h" michael@0: #ifndef MOZ_DISABLE_CRYPTOLEGACY michael@0: #include "mozilla/dom/NonRefcountedDOMObject.h" michael@0: #include "Crypto.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIDOMCryptoLegacy.h" michael@0: #include "nsIRunnable.h" michael@0: #include "nsString.h" michael@0: #include "nsIPrincipal.h" michael@0: michael@0: #define NS_CRYPTO_CID \ michael@0: {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} } michael@0: #define PSM_VERSION_STRING "2.4" michael@0: michael@0: class nsIPSMComponent; michael@0: class nsIDOMScriptObjectFactory; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class CRMFObject : public NonRefcountedDOMObject michael@0: { michael@0: public: michael@0: CRMFObject(); michael@0: virtual ~CRMFObject(); michael@0: michael@0: nsresult SetCRMFRequest(char *inRequest); michael@0: michael@0: JSObject* WrapObject(JSContext *aCx, bool* aTookOwnership); michael@0: michael@0: void GetRequest(nsAString& aRequest); michael@0: michael@0: private: michael@0: nsString mBase64Request; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: class nsCrypto: public mozilla::dom::Crypto michael@0: { michael@0: public: michael@0: nsCrypto(); michael@0: virtual ~nsCrypto(); michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: // If legacy DOM crypto is enabled this is the class that actually michael@0: // implements the legacy methods. michael@0: NS_DECL_NSIDOMCRYPTO michael@0: michael@0: virtual bool EnableSmartCardEvents() MOZ_OVERRIDE; michael@0: virtual void SetEnableSmartCardEvents(bool aEnable, michael@0: mozilla::ErrorResult& aRv) MOZ_OVERRIDE; michael@0: michael@0: virtual void GetVersion(nsString& aVersion) MOZ_OVERRIDE; michael@0: michael@0: virtual mozilla::dom::CRMFObject* michael@0: GenerateCRMFRequest(JSContext* aContext, michael@0: const nsCString& aReqDN, michael@0: const nsCString& aRegToken, michael@0: const nsCString& aAuthenticator, michael@0: const nsCString& aEaCert, michael@0: const nsCString& aJsCallback, michael@0: const mozilla::dom::Sequence& aArgs, michael@0: mozilla::ErrorResult& aRv) MOZ_OVERRIDE; michael@0: michael@0: virtual void ImportUserCertificates(const nsAString& aNickname, michael@0: const nsAString& aCmmfResponse, michael@0: bool aDoForcedBackup, michael@0: nsAString& aReturn, michael@0: mozilla::ErrorResult& aRv) MOZ_OVERRIDE; michael@0: michael@0: virtual void SignText(JSContext* aContext, michael@0: const nsAString& aStringToSign, michael@0: const nsAString& aCaOption, michael@0: const mozilla::dom::Sequence& aArgs, michael@0: nsAString& aReturn) MOZ_OVERRIDE; michael@0: michael@0: virtual void Logout(mozilla::ErrorResult& aRv) MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: static already_AddRefed GetScriptPrincipal(JSContext *cx); michael@0: michael@0: bool mEnableSmartCardEvents; michael@0: }; michael@0: #endif // MOZ_DISABLE_CRYPTOLEGACY michael@0: michael@0: #include "nsIPKCS11.h" michael@0: michael@0: #define NS_PKCS11_CID \ michael@0: {0x74b7a390, 0x3b41, 0x11d4, { 0x8a, 0x80, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} } michael@0: michael@0: class nsPkcs11 : public nsIPKCS11 michael@0: { michael@0: public: michael@0: nsPkcs11(); michael@0: virtual ~nsPkcs11(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIPKCS11 michael@0: michael@0: }; michael@0: michael@0: #endif //_nsCrypto_h_