security/manager/ssl/src/nsCrypto.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/manager/ssl/src/nsCrypto.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,114 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +#ifndef _nsCrypto_h_
    1.10 +#define _nsCrypto_h_
    1.11 +
    1.12 +#include "mozilla/dom/BindingDeclarations.h"
    1.13 +#include "mozilla/ErrorResult.h"
    1.14 +#ifndef MOZ_DISABLE_CRYPTOLEGACY
    1.15 +#include "mozilla/dom/NonRefcountedDOMObject.h"
    1.16 +#include "Crypto.h"
    1.17 +#include "nsCOMPtr.h"
    1.18 +#include "nsIDOMCryptoLegacy.h"
    1.19 +#include "nsIRunnable.h"
    1.20 +#include "nsString.h"
    1.21 +#include "nsIPrincipal.h"
    1.22 +
    1.23 +#define NS_CRYPTO_CID \
    1.24 +  {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
    1.25 +#define PSM_VERSION_STRING "2.4"
    1.26 +
    1.27 +class nsIPSMComponent;
    1.28 +class nsIDOMScriptObjectFactory;
    1.29 +
    1.30 +namespace mozilla {
    1.31 +namespace dom {
    1.32 +
    1.33 +class CRMFObject : public NonRefcountedDOMObject
    1.34 +{
    1.35 +public:
    1.36 +  CRMFObject();
    1.37 +  virtual ~CRMFObject();
    1.38 +
    1.39 +  nsresult SetCRMFRequest(char *inRequest);
    1.40 +
    1.41 +  JSObject* WrapObject(JSContext *aCx, bool* aTookOwnership);
    1.42 +
    1.43 +  void GetRequest(nsAString& aRequest);
    1.44 +
    1.45 +private:
    1.46 +  nsString mBase64Request;
    1.47 +};
    1.48 +
    1.49 +}
    1.50 +}
    1.51 +
    1.52 +class nsCrypto: public mozilla::dom::Crypto
    1.53 +{
    1.54 +public:
    1.55 +  nsCrypto();
    1.56 +  virtual ~nsCrypto();
    1.57 +
    1.58 +  NS_DECL_ISUPPORTS_INHERITED
    1.59 +
    1.60 +  // If legacy DOM crypto is enabled this is the class that actually
    1.61 +  // implements the legacy methods.
    1.62 +  NS_DECL_NSIDOMCRYPTO
    1.63 +
    1.64 +  virtual bool EnableSmartCardEvents() MOZ_OVERRIDE;
    1.65 +  virtual void SetEnableSmartCardEvents(bool aEnable,
    1.66 +                                        mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    1.67 +
    1.68 +  virtual void GetVersion(nsString& aVersion) MOZ_OVERRIDE;
    1.69 +
    1.70 +  virtual mozilla::dom::CRMFObject*
    1.71 +  GenerateCRMFRequest(JSContext* aContext,
    1.72 +                      const nsCString& aReqDN,
    1.73 +                      const nsCString& aRegToken,
    1.74 +                      const nsCString& aAuthenticator,
    1.75 +                      const nsCString& aEaCert,
    1.76 +                      const nsCString& aJsCallback,
    1.77 +                      const mozilla::dom::Sequence<JS::Value>& aArgs,
    1.78 +                      mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    1.79 +
    1.80 +  virtual void ImportUserCertificates(const nsAString& aNickname,
    1.81 +                                      const nsAString& aCmmfResponse,
    1.82 +                                      bool aDoForcedBackup,
    1.83 +                                      nsAString& aReturn,
    1.84 +                                      mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    1.85 +
    1.86 +  virtual void SignText(JSContext* aContext,
    1.87 +                        const nsAString& aStringToSign,
    1.88 +                        const nsAString& aCaOption,
    1.89 +                        const mozilla::dom::Sequence<nsCString>& aArgs,
    1.90 +                        nsAString& aReturn) MOZ_OVERRIDE;
    1.91 +
    1.92 +  virtual void Logout(mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
    1.93 +
    1.94 +private:
    1.95 +  static already_AddRefed<nsIPrincipal> GetScriptPrincipal(JSContext *cx);
    1.96 +
    1.97 +  bool mEnableSmartCardEvents;
    1.98 +};
    1.99 +#endif // MOZ_DISABLE_CRYPTOLEGACY
   1.100 +
   1.101 +#include "nsIPKCS11.h"
   1.102 +
   1.103 +#define NS_PKCS11_CID \
   1.104 +  {0x74b7a390, 0x3b41, 0x11d4, { 0x8a, 0x80, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
   1.105 +
   1.106 +class nsPkcs11 : public nsIPKCS11
   1.107 +{
   1.108 +public:
   1.109 +  nsPkcs11();
   1.110 +  virtual ~nsPkcs11();
   1.111 +
   1.112 +  NS_DECL_ISUPPORTS
   1.113 +  NS_DECL_NSIPKCS11
   1.114 +
   1.115 +};
   1.116 +
   1.117 +#endif //_nsCrypto_h_

mercurial