Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef _NSKEYGENHANDLER_H_ |
michael@0 | 8 | #define _NSKEYGENHANDLER_H_ |
michael@0 | 9 | // Form Processor |
michael@0 | 10 | #include "nsIFormProcessor.h" |
michael@0 | 11 | #include "nsTArray.h" |
michael@0 | 12 | |
michael@0 | 13 | nsresult GetSlotWithMechanism(uint32_t mechanism, |
michael@0 | 14 | nsIInterfaceRequestor *ctx, |
michael@0 | 15 | PK11SlotInfo **retSlot); |
michael@0 | 16 | |
michael@0 | 17 | #define DEFAULT_RSA_KEYGEN_PE 65537L |
michael@0 | 18 | #define DEFAULT_RSA_KEYGEN_ALG SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION |
michael@0 | 19 | |
michael@0 | 20 | SECKEYECParams *decode_ec_params(const char *curve); |
michael@0 | 21 | |
michael@0 | 22 | class nsKeygenFormProcessor : public nsIFormProcessor { |
michael@0 | 23 | public: |
michael@0 | 24 | nsKeygenFormProcessor(); |
michael@0 | 25 | virtual ~nsKeygenFormProcessor(); |
michael@0 | 26 | nsresult Init(); |
michael@0 | 27 | |
michael@0 | 28 | NS_IMETHOD ProcessValue(nsIDOMHTMLElement *aElement, |
michael@0 | 29 | const nsAString& aName, |
michael@0 | 30 | nsAString& aValue); |
michael@0 | 31 | |
michael@0 | 32 | NS_IMETHOD ProvideContent(const nsAString& aFormType, |
michael@0 | 33 | nsTArray<nsString>& aContent, |
michael@0 | 34 | nsAString& aAttribute); |
michael@0 | 35 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 36 | |
michael@0 | 37 | static nsresult Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult); |
michael@0 | 38 | |
michael@0 | 39 | protected: |
michael@0 | 40 | nsresult GetPublicKey(nsAString& aValue, nsAString& aChallenge, |
michael@0 | 41 | nsAFlatString& akeyType, nsAString& aOutPublicKey, |
michael@0 | 42 | nsAString& aPqg); |
michael@0 | 43 | nsresult GetSlot(uint32_t aMechanism, PK11SlotInfo** aSlot); |
michael@0 | 44 | private: |
michael@0 | 45 | nsCOMPtr<nsIInterfaceRequestor> m_ctx; |
michael@0 | 46 | |
michael@0 | 47 | typedef struct SECKeySizeChoiceInfoStr { |
michael@0 | 48 | nsString name; |
michael@0 | 49 | int size; |
michael@0 | 50 | } SECKeySizeChoiceInfo; |
michael@0 | 51 | |
michael@0 | 52 | enum { number_of_key_size_choices = 2 }; |
michael@0 | 53 | |
michael@0 | 54 | SECKeySizeChoiceInfo mSECKeySizeChoiceList[number_of_key_size_choices]; |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | #endif //_NSKEYGENHANDLER_H_ |