mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
3f882a20a0
From 9beed249a4d08ccc945bc573a0c71d295cb1b222 Mon Sep 17 00:00:00 2001 --HG-- rename : dom/crypto/Key.cpp => dom/crypto/CryptoKey.cpp rename : dom/crypto/Key.h => dom/crypto/CryptoKey.h rename : dom/crypto/KeyPair.cpp => dom/crypto/CryptoKeyPair.cpp rename : dom/crypto/KeyPair.h => dom/crypto/CryptoKeyPair.h
64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_dom_CryptoKeyPair_h
|
|
#define mozilla_dom_CryptoKeyPair_h
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
#include "nsWrapperCache.h"
|
|
#include "nsIGlobalObject.h"
|
|
#include "mozilla/dom/CryptoKey.h"
|
|
#include "js/TypeDecls.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
class CryptoKeyPair MOZ_FINAL : public nsISupports,
|
|
public nsWrapperCache
|
|
{
|
|
public:
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CryptoKeyPair)
|
|
|
|
public:
|
|
CryptoKeyPair(nsIGlobalObject* aGlobal)
|
|
: mGlobal(aGlobal)
|
|
, mPublicKey(new CryptoKey(aGlobal))
|
|
, mPrivateKey(new CryptoKey(aGlobal))
|
|
{
|
|
SetIsDOMBinding();
|
|
}
|
|
|
|
nsIGlobalObject* GetParentObject() const
|
|
{
|
|
return mGlobal;
|
|
}
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
|
|
|
CryptoKey* PublicKey() const
|
|
{
|
|
return mPublicKey;
|
|
}
|
|
|
|
CryptoKey* PrivateKey() const
|
|
{
|
|
return mPrivateKey;
|
|
}
|
|
|
|
private:
|
|
~CryptoKeyPair() {}
|
|
|
|
nsRefPtr<nsIGlobalObject> mGlobal;
|
|
nsRefPtr<CryptoKey> mPublicKey;
|
|
nsRefPtr<CryptoKey> mPrivateKey;
|
|
};
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_dom_CryptoKeyPair_h
|