Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef _NSKEYGENHANDLER_H_
8 #define _NSKEYGENHANDLER_H_
9 // Form Processor
10 #include "nsIFormProcessor.h"
11 #include "nsTArray.h"
13 nsresult GetSlotWithMechanism(uint32_t mechanism,
14 nsIInterfaceRequestor *ctx,
15 PK11SlotInfo **retSlot);
17 #define DEFAULT_RSA_KEYGEN_PE 65537L
18 #define DEFAULT_RSA_KEYGEN_ALG SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION
20 SECKEYECParams *decode_ec_params(const char *curve);
22 class nsKeygenFormProcessor : public nsIFormProcessor {
23 public:
24 nsKeygenFormProcessor();
25 virtual ~nsKeygenFormProcessor();
26 nsresult Init();
28 NS_IMETHOD ProcessValue(nsIDOMHTMLElement *aElement,
29 const nsAString& aName,
30 nsAString& aValue);
32 NS_IMETHOD ProvideContent(const nsAString& aFormType,
33 nsTArray<nsString>& aContent,
34 nsAString& aAttribute);
35 NS_DECL_THREADSAFE_ISUPPORTS
37 static nsresult Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
39 protected:
40 nsresult GetPublicKey(nsAString& aValue, nsAString& aChallenge,
41 nsAFlatString& akeyType, nsAString& aOutPublicKey,
42 nsAString& aPqg);
43 nsresult GetSlot(uint32_t aMechanism, PK11SlotInfo** aSlot);
44 private:
45 nsCOMPtr<nsIInterfaceRequestor> m_ctx;
47 typedef struct SECKeySizeChoiceInfoStr {
48 nsString name;
49 int size;
50 } SECKeySizeChoiceInfo;
52 enum { number_of_key_size_choices = 2 };
54 SECKeySizeChoiceInfo mSECKeySizeChoiceList[number_of_key_size_choices];
55 };
57 #endif //_NSKEYGENHANDLER_H_