2014-05-26 03:05:00 -07:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
2014-06-23 14:25:13 -07:00
|
|
|
#ifndef mozilla_dom_CryptoKeyPair_h
|
|
|
|
#define mozilla_dom_CryptoKeyPair_h
|
2014-05-26 03:05:00 -07:00
|
|
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsIGlobalObject.h"
|
2014-06-23 14:25:13 -07:00
|
|
|
#include "mozilla/dom/CryptoKey.h"
|
2014-05-26 03:05:00 -07:00
|
|
|
#include "js/TypeDecls.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-06-23 14:25:13 -07:00
|
|
|
class CryptoKeyPair MOZ_FINAL : public nsISupports,
|
|
|
|
public nsWrapperCache
|
2014-05-26 03:05:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-06-23 14:25:13 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CryptoKeyPair)
|
2014-05-26 03:05:00 -07:00
|
|
|
|
|
|
|
public:
|
2014-06-23 14:25:13 -07:00
|
|
|
CryptoKeyPair(nsIGlobalObject* aGlobal)
|
2014-05-26 03:05:00 -07:00
|
|
|
: mGlobal(aGlobal)
|
2014-06-23 14:25:13 -07:00
|
|
|
, mPublicKey(new CryptoKey(aGlobal))
|
|
|
|
, mPrivateKey(new CryptoKey(aGlobal))
|
2014-05-26 03:05:00 -07:00
|
|
|
{
|
|
|
|
SetIsDOMBinding();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIGlobalObject* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mGlobal;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
|
|
|
|
2014-06-23 14:25:13 -07:00
|
|
|
CryptoKey* PublicKey() const
|
2014-05-26 03:05:00 -07:00
|
|
|
{
|
|
|
|
return mPublicKey;
|
|
|
|
}
|
|
|
|
|
2014-06-23 14:25:13 -07:00
|
|
|
CryptoKey* PrivateKey() const
|
2014-05-26 03:05:00 -07:00
|
|
|
{
|
|
|
|
return mPrivateKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-06-23 14:25:13 -07:00
|
|
|
~CryptoKeyPair() {}
|
2014-06-23 12:56:07 -07:00
|
|
|
|
2014-05-26 03:05:00 -07:00
|
|
|
nsRefPtr<nsIGlobalObject> mGlobal;
|
2014-06-23 14:25:13 -07:00
|
|
|
nsRefPtr<CryptoKey> mPublicKey;
|
|
|
|
nsRefPtr<CryptoKey> mPrivateKey;
|
2014-05-26 03:05:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-06-23 14:25:13 -07:00
|
|
|
#endif // mozilla_dom_CryptoKeyPair_h
|