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: michael@0: #ifndef _NSKEYGENHANDLER_H_ michael@0: #define _NSKEYGENHANDLER_H_ michael@0: // Form Processor michael@0: #include "nsIFormProcessor.h" michael@0: #include "nsTArray.h" michael@0: michael@0: nsresult GetSlotWithMechanism(uint32_t mechanism, michael@0: nsIInterfaceRequestor *ctx, michael@0: PK11SlotInfo **retSlot); michael@0: michael@0: #define DEFAULT_RSA_KEYGEN_PE 65537L michael@0: #define DEFAULT_RSA_KEYGEN_ALG SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION michael@0: michael@0: SECKEYECParams *decode_ec_params(const char *curve); michael@0: michael@0: class nsKeygenFormProcessor : public nsIFormProcessor { michael@0: public: michael@0: nsKeygenFormProcessor(); michael@0: virtual ~nsKeygenFormProcessor(); michael@0: nsresult Init(); michael@0: michael@0: NS_IMETHOD ProcessValue(nsIDOMHTMLElement *aElement, michael@0: const nsAString& aName, michael@0: nsAString& aValue); michael@0: michael@0: NS_IMETHOD ProvideContent(const nsAString& aFormType, michael@0: nsTArray& aContent, michael@0: nsAString& aAttribute); michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: michael@0: static nsresult Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult); michael@0: michael@0: protected: michael@0: nsresult GetPublicKey(nsAString& aValue, nsAString& aChallenge, michael@0: nsAFlatString& akeyType, nsAString& aOutPublicKey, michael@0: nsAString& aPqg); michael@0: nsresult GetSlot(uint32_t aMechanism, PK11SlotInfo** aSlot); michael@0: private: michael@0: nsCOMPtr m_ctx; michael@0: michael@0: typedef struct SECKeySizeChoiceInfoStr { michael@0: nsString name; michael@0: int size; michael@0: } SECKeySizeChoiceInfo; michael@0: michael@0: enum { number_of_key_size_choices = 2 }; michael@0: michael@0: SECKeySizeChoiceInfo mSECKeySizeChoiceList[number_of_key_size_choices]; michael@0: }; michael@0: michael@0: #endif //_NSKEYGENHANDLER_H_