/src/mozilla-central/security/manager/ssl/nsKeygenHandler.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #ifndef nsKeygenHandler_h |
8 | | #define nsKeygenHandler_h |
9 | | |
10 | | #include "ScopedNSSTypes.h" |
11 | | #include "keythi.h" |
12 | | #include "nsCOMPtr.h" |
13 | | #include "nsError.h" |
14 | | #include "nsIFormProcessor.h" |
15 | | #include "nsIInterfaceRequestor.h" |
16 | | #include "nsString.h" |
17 | | #include "nsTArray.h" |
18 | | #include "secmodt.h" |
19 | | |
20 | | nsresult GetSlotWithMechanism(uint32_t mechanism, |
21 | | nsIInterfaceRequestor* ctx, |
22 | | PK11SlotInfo** retSlot); |
23 | | |
24 | 0 | #define DEFAULT_RSA_KEYGEN_PE 65537L |
25 | 0 | #define DEFAULT_RSA_KEYGEN_ALG SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION |
26 | | |
27 | | mozilla::UniqueSECItem DecodeECParams(const char* curve); |
28 | | |
29 | | class nsKeygenFormProcessor : public nsIFormProcessor |
30 | | { |
31 | | public: |
32 | | nsKeygenFormProcessor(); |
33 | | nsresult Init(); |
34 | | |
35 | | virtual nsresult ProcessValue(mozilla::dom::Element* aElement, |
36 | | const nsAString& aName, |
37 | | nsAString& aValue) override; |
38 | | |
39 | | virtual nsresult ProcessValueIPC(const nsAString& aOldValue, |
40 | | const nsAString& aChallenge, |
41 | | const nsAString& aKeyType, |
42 | | const nsAString& aKeyParams, |
43 | | nsAString& aNewValue) override; |
44 | | |
45 | | virtual nsresult ProvideContent(const nsAString& aFormType, |
46 | | nsTArray<nsString>& aContent, |
47 | | nsAString& aAttribute) override; |
48 | | NS_DECL_THREADSAFE_ISUPPORTS |
49 | | |
50 | | static nsresult Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult); |
51 | | |
52 | | static void ExtractParams(mozilla::dom::Element* aElement, |
53 | | nsAString& challengeValue, |
54 | | nsAString& keyTypeValue, |
55 | | nsAString& keyParamsValue); |
56 | | |
57 | | protected: |
58 | 0 | virtual ~nsKeygenFormProcessor() {} |
59 | | |
60 | | nsresult GetPublicKey(const nsAString& aValue, const nsAString& aChallenge, |
61 | | const nsString& akeyType, nsAString& aOutPublicKey, |
62 | | const nsAString& aPqg); |
63 | | nsresult GetSlot(uint32_t aMechanism, PK11SlotInfo** aSlot); |
64 | | private: |
65 | | nsCOMPtr<nsIInterfaceRequestor> m_ctx; |
66 | | |
67 | | typedef struct SECKeySizeChoiceInfoStr { |
68 | | nsString name; |
69 | | int size; |
70 | | } SECKeySizeChoiceInfo; |
71 | | |
72 | | enum { number_of_key_size_choices = 2 }; |
73 | | |
74 | | SECKeySizeChoiceInfo mSECKeySizeChoiceList[number_of_key_size_choices]; |
75 | | }; |
76 | | |
77 | | #endif // nsKeygenHandler_h |