security/manager/ssl/src/nsCrypto.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef _nsCrypto_h_
     7 #define _nsCrypto_h_
     9 #include "mozilla/dom/BindingDeclarations.h"
    10 #include "mozilla/ErrorResult.h"
    11 #ifndef MOZ_DISABLE_CRYPTOLEGACY
    12 #include "mozilla/dom/NonRefcountedDOMObject.h"
    13 #include "Crypto.h"
    14 #include "nsCOMPtr.h"
    15 #include "nsIDOMCryptoLegacy.h"
    16 #include "nsIRunnable.h"
    17 #include "nsString.h"
    18 #include "nsIPrincipal.h"
    20 #define NS_CRYPTO_CID \
    21   {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
    22 #define PSM_VERSION_STRING "2.4"
    24 class nsIPSMComponent;
    25 class nsIDOMScriptObjectFactory;
    27 namespace mozilla {
    28 namespace dom {
    30 class CRMFObject : public NonRefcountedDOMObject
    31 {
    32 public:
    33   CRMFObject();
    34   virtual ~CRMFObject();
    36   nsresult SetCRMFRequest(char *inRequest);
    38   JSObject* WrapObject(JSContext *aCx, bool* aTookOwnership);
    40   void GetRequest(nsAString& aRequest);
    42 private:
    43   nsString mBase64Request;
    44 };
    46 }
    47 }
    49 class nsCrypto: public mozilla::dom::Crypto
    50 {
    51 public:
    52   nsCrypto();
    53   virtual ~nsCrypto();
    55   NS_DECL_ISUPPORTS_INHERITED
    57   // If legacy DOM crypto is enabled this is the class that actually
    58   // implements the legacy methods.
    59   NS_DECL_NSIDOMCRYPTO
    61   virtual bool EnableSmartCardEvents() MOZ_OVERRIDE;
    62   virtual void SetEnableSmartCardEvents(bool aEnable,
    63                                         mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    65   virtual void GetVersion(nsString& aVersion) MOZ_OVERRIDE;
    67   virtual mozilla::dom::CRMFObject*
    68   GenerateCRMFRequest(JSContext* aContext,
    69                       const nsCString& aReqDN,
    70                       const nsCString& aRegToken,
    71                       const nsCString& aAuthenticator,
    72                       const nsCString& aEaCert,
    73                       const nsCString& aJsCallback,
    74                       const mozilla::dom::Sequence<JS::Value>& aArgs,
    75                       mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    77   virtual void ImportUserCertificates(const nsAString& aNickname,
    78                                       const nsAString& aCmmfResponse,
    79                                       bool aDoForcedBackup,
    80                                       nsAString& aReturn,
    81                                       mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    83   virtual void SignText(JSContext* aContext,
    84                         const nsAString& aStringToSign,
    85                         const nsAString& aCaOption,
    86                         const mozilla::dom::Sequence<nsCString>& aArgs,
    87                         nsAString& aReturn) MOZ_OVERRIDE;
    89   virtual void Logout(mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    91 private:
    92   static already_AddRefed<nsIPrincipal> GetScriptPrincipal(JSContext *cx);
    94   bool mEnableSmartCardEvents;
    95 };
    96 #endif // MOZ_DISABLE_CRYPTOLEGACY
    98 #include "nsIPKCS11.h"
   100 #define NS_PKCS11_CID \
   101   {0x74b7a390, 0x3b41, 0x11d4, { 0x8a, 0x80, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
   103 class nsPkcs11 : public nsIPKCS11
   104 {
   105 public:
   106   nsPkcs11();
   107   virtual ~nsPkcs11();
   109   NS_DECL_ISUPPORTS
   110   NS_DECL_NSIPKCS11
   112 };
   114 #endif //_nsCrypto_h_

mercurial