Botan  2.4.0
Crypto and TLS for C++11
ec_named.cpp
Go to the documentation of this file.
1 /*
2 * List of ECC groups
3 * (C) 2013 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #include <botan/ec_group.h>
9 
10 namespace Botan {
11 
12 //static
13 std::string EC_Group::PEM_for_named_group(const std::string& name)
14  {
15  if(name == "secp160k1")
16  return
17  "-----BEGIN EC PARAMETERS-----"
18  "MIGYAgEBMCAGByqGSM49AQECFQD////////////////////+//+sczAsBBQAAAAA"
19  "AAAAAAAAAAAAAAAAAAAAAAQUAAAAAAAAAAAAAAAAAAAAAAAAAAcEKQQ7TDgs43qh"
20  "kqQBnnYwNvT13U1+u5OM+TUxj9zta8KChlMXM8PwPE/uAhUBAAAAAAAAAAAAAbj6"
21  "Ft+rmsoWtrMCAQE="
22  "-----END EC PARAMETERS-----";
23 
24  if(name == "secp160r1")
25  return
26  "-----BEGIN EC PARAMETERS-----"
27  "MIGYAgEBMCAGByqGSM49AQECFQD/////////////////////f////zAsBBT/////"
28  "////////////////f////AQUHJe+/FS9eotlrPifgdTUrcVl+kUEKQRKlrVojvVz"
29  "KEZkaYlow4u5E8v8giOmKFUxaJR9WdzJEgQjUTd6xfsyAhUBAAAAAAAAAAAAAfTI"
30  "+Seu08p1IlcCAQE="
31  "-----END EC PARAMETERS-----";
32 
33  if(name == "secp160r2")
34  return
35  "-----BEGIN EC PARAMETERS-----"
36  "MIGYAgEBMCAGByqGSM49AQECFQD////////////////////+//+sczAsBBT/////"
37  "///////////////+//+scAQUtOE00/tZ64urVydJBGZNWvUDiLoEKQRS3LA0KToR"
38  "fh9P8Rsw9xmdMUTObf6v/vLjMfKW4HH6DfmYLP6n1D8uAhUBAAAAAAAAAAAAADUe"
39  "54aoGPOhoWsCAQE="
40  "-----END EC PARAMETERS-----";
41 
42  if(name == "secp192k1")
43  return
44  "-----BEGIN EC PARAMETERS-----"
45  "MIGwAgEBMCQGByqGSM49AQECGQD//////////////////////////v//7jcwNAQY"
46  "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
47  "AAMEMQTbT/EOwFfpriawfQKAt/Q0HaXRsergbH2bLy9tnFYop4RBY9AVvoY0QIKq"
48  "iNleL50CGQD///////////////4m8vwXD2lGanTe/Y0CAQE="
49  "-----END EC PARAMETERS-----";
50 
51  if(name == "secp192r1")
52  return
53  "-----BEGIN EC PARAMETERS-----"
54  "MIGwAgEBMCQGByqGSM49AQECGQD////////////////////+//////////8wNAQY"
55  "/////////////////////v/////////8BBhkIQUZ5ZyA5w+n6atyJDBJ/rje7MFG"
56  "ubEEMQQYjagOsDCQ9ny/IOtDoYgA9P8K/YL/EBIHGSuV/8jaeGMQEe1rJM3Vc/l3"
57  "oR55SBECGQD///////////////+Z3vg2FGvJsbTSKDECAQE="
58  "-----END EC PARAMETERS-----";
59 
60  if(name == "secp224k1")
61  return
62  "-----BEGIN EC PARAMETERS-----"
63  "MIHIAgEBMCgGByqGSM49AQECHQD///////////////////////////////7//+Vt"
64  "MDwEHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEHAAAAAAAAAAAAAAAAAAA"
65  "AAAAAAAAAAAAAAAAAAUEOQShRVszTfCZ3zD8KKFppGfp5HB1qQ9+ZQ62t6Rcfgif"
66  "7X+6NEKCyvvW9+MZ98CwvVniykvbVW1hpQIdAQAAAAAAAAAAAAAAAAAB3OjS7GGE"
67  "yvCpcXafsfcCAQE="
68  "-----END EC PARAMETERS-----";
69 
70  if(name == "secp224r1")
71  return
72  "-----BEGIN EC PARAMETERS-----"
73  "MIHIAgEBMCgGByqGSM49AQECHQD/////////////////////AAAAAAAAAAAAAAAB"
74  "MDwEHP////////////////////7///////////////4EHLQFCoUMBLOr9UEyVlBE"
75  "sLfXv9i6Jws5QyNV/7QEOQS3Dgy9a7S/fzITkLlKA8HTVsIRIjQygNYRXB0hvTdj"
76  "iLX3I/tMIt/mzUN1oFoHR2RE1YGZhQB+NAIdAP//////////////////FqLguPA+"
77  "E90pRVxcKj0CAQE="
78  "-----END EC PARAMETERS-----";
79 
80  if(name == "secp256k1")
81  return
82  "-----BEGIN EC PARAMETERS-----"
83  "MIHgAgEBMCwGByqGSM49AQECIQD////////////////////////////////////+"
84  "///8LzBEBCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgAAAAAAAA"
85  "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcEQQR5vmZ++dy7rFWgYpXOhwsHApv8"
86  "2y3OKNlZ8oFbFvgXmEg62ncmo8RlXaT7/A4RCKj9F7RIpoVUGZxH0I/7ENS4AiEA"
87  "/////////////////////rqu3OavSKA7v9JejNA2QUECAQE="
88  "-----END EC PARAMETERS-----";
89 
90  if(name == "secp256r1")
91  return
92  "-----BEGIN EC PARAMETERS-----"
93  "MIHgAgEBMCwGByqGSM49AQECIQD/////AAAAAQAAAAAAAAAAAAAAAP//////////"
94  "/////zBEBCD/////AAAAAQAAAAAAAAAAAAAAAP///////////////AQgWsY12Ko6"
95  "k+ez671VdpiGvGUdBrDMU7D2O848PifSYEsEQQRrF9Hy4SxCR/i85uVjpEDydwN9"
96  "gS3rM6D0oTlF2JjClk/jQuL+Gn+bjufrSnwPnhYrzjNXazFezsu2QGg3v1H1AiEA"
97  "/////wAAAAD//////////7zm+q2nF56E87nKwvxjJVECAQE="
98  "-----END EC PARAMETERS-----";
99 
100  if(name == "secp384r1")
101  return
102  "-----BEGIN EC PARAMETERS-----"
103  "MIIBQAIBATA8BgcqhkjOPQEBAjEA////////////////////////////////////"
104  "//////7/////AAAAAAAAAAD/////MGQEMP//////////////////////////////"
105  "///////////+/////wAAAAAAAAAA/////AQwszEvp+I+5+SYjgVr4/gtGRgdnG7+"
106  "gUESAxQIj1ATh1rGVjmNii7RnSqFyO3T7CrvBGEEqofKIr6LBTeOscce8yCtdG4d"
107  "O2KLp5uYWfdB4IJUKjhVAvJdv1UpbDpUXjhydgq3NhfeSpYmLG9dnpi/kpLcKfj0"
108  "Hb0omhR86doxE7XwuMAKYLHOHX6BnXpDHXyQ6g5fAjEA////////////////////"
109  "////////////x2NNgfQ3Ld9YGg2ySLCneuzsGWrMxSlzAgEB"
110  "-----END EC PARAMETERS-----";
111 
112  if(name == "secp521r1")
113  return
114  "-----BEGIN EC PARAMETERS-----"
115  "MIIBrAIBATBNBgcqhkjOPQEBAkIB////////////////////////////////////"
116  "//////////////////////////////////////////////////8wgYgEQgH/////"
117  "////////////////////////////////////////////////////////////////"
118  "/////////////////ARCAFGVPrlhjhyaH5KaIaC2hUDuotpyW5mzFfO4tImRjvEJ"
119  "4VYZOVHsfpN7FlLAvTuxvwc1c9+IPSw08e9FH9RrUD8ABIGFBADGhY4GtwQE6c2e"
120  "PstmI5W0QpxkgTkFP7Uh+CivYGtNPbqhS1537+dZKP4dwSei/6jeM0izwYVqQpv5"
121  "fn4xwuW9ZgEYOSlqeJo7wARcil+0LH0b2Zj1RElXm0RoF6+9Fyc+ZiyX7nKZXvQm"
122  "QMVQuQE/rQdhNTxwhqJywkCIvpR2n9FmUAJCAf//////////////////////////"
123  "////////////////+lGGh4O/L5Zrf8wBSPcJpdA7tcm4iZxHrrtvtx6ROGQJAgEB"
124  "-----END EC PARAMETERS-----";
125 
126  if(name == "brainpool160r1")
127  return
128  "-----BEGIN EC PARAMETERS-----"
129  "MIGYAgEBMCAGByqGSM49AQECFQDpXkpfc3BZ3GDfx62Vs9gTlRViDzAsBBQ0Dnvi"
130  "ooDrdOK+YbradF2X6PfDAAQUHliahZVCNBITT6otveyVyNhnXlgEKQS+1a8W6j9q"
131  "T2KTjEYx61r3vbzbwxZny0d6Go7DOPlHQWacl2MW2mMhAhUA6V5KX3NwWdxg31mR"
132  "1FApQJ5g/AkCAQE="
133  "-----END EC PARAMETERS-----";
134 
135  if(name == "brainpool192r1")
136  return
137  "-----BEGIN EC PARAMETERS-----"
138  "MIGwAgEBMCQGByqGSM49AQECGQDDAvQdkyo2zaejRjCT0Y23j85HbeGoYpcwNAQY"
139  "apEXQHax4OGcOcAx/oaFwcrgQOXGmijvBBhGmijvfCjMo9xyHQRPRJa8yn70FG+/"
140  "JckEMQTAoGR+qrakh1OwM8VssPCQCi9cSFM3X9YUtpCGar1buItfSCjBSQAC5nc/"
141  "ovopm48CGQDDAvQdkyo2zaejRi+enpFrW+jxAprErMECAQE="
142  "-----END EC PARAMETERS-----";
143 
144  if(name == "brainpool224r1")
145  return
146  "-----BEGIN EC PARAMETERS-----"
147  "MIHIAgEBMCgGByqGSM49AQECHQDXwTSqJkNmhioYMCV10deHsJ8HV5faifV+yMD/"
148  "MDwEHGil5iypzmwcKZgDpsFTC1FOGCrYsAQqWcrSn0MEHCWA9jzP5EE4hwcTsakj"
149  "aeM+ITXSZtuzcjhsQAsEOQQNkCmtLH5c9DQII7KofcaMnkzjF0webv3uEsB9WKpW"
150  "93LAcm8kxrieTs2sJDVLnpnKo/bTdhQCzQIdANfBNKomQ2aGKhgwJXXQ+5jRFrxL"
151  "bd68o6Wnk58CAQE="
152  "-----END EC PARAMETERS-----";
153 
154  if(name == "brainpool256r1")
155  return
156  "-----BEGIN EC PARAMETERS-----"
157  "MIHgAgEBMCwGByqGSM49AQECIQCp+1fboe6pvD5mCpCdg41ybjv2I9UmICggE0gd"
158  "H25TdzBEBCB9Wgl1/CwwV+72dTBBev/n+4BVwSbcXGzpSktE8zC12QQgJtxcbOlK"
159  "S0TzMLXZu9d8v5WEFilc9+HOa8zcGP+MB7YEQQSL0q65y35XyyxLSC/8gbevud4n"
160  "4eO9I8I6RFO9ms4yYlR++DXD2sT9l/hGGhRhHcnCd0UTLe2OVFwdVMcvBGmXAiEA"
161  "qftX26Huqbw+ZgqQnYONcYw5eqO1Yab3kB4OgpdIVqcCAQE="
162  "-----END EC PARAMETERS-----";
163 
164  if(name == "brainpool320r1")
165  return
166  "-----BEGIN EC PARAMETERS-----"
167  "MIIBEAIBATA0BgcqhkjOPQEBAikA015HIDa8T7fhPHhe0gHgZfmPz6b29A3vT5K5"
168  "7HiT7Cj81BKx8bMuJzBUBCg+4wtWj7qw+IPM69RtPzu4oqc1E/XredpmGQ6whf+p"
169  "9JLzdal9hg60BChSCIOUnf28QtOtGYZAaIpv4T9BNJVUtJrMMdzNiEU5gW9etKyP"
170  "sfGmBFEEQ71+mvtT2LhSibzEjuW/5vIBN9EKCH6254ceKhClmccQr40NOeIGERT9"
171  "0FVF7BzIq0CTJH93J14HQ//tEXGC6qnHeHeqrGrH01JF0WkujuECKQDTXkcgNrxP"
172  "t+E8eF7SAeBl+Y/PpbaPEqMtSC7H7oZY6YaRVVtExZMRAgEB"
173  "-----END EC PARAMETERS-----";
174 
175  if(name == "brainpool384r1")
176  return
177  "-----BEGIN EC PARAMETERS-----"
178  "MIIBQAIBATA8BgcqhkjOPQEBAjEAjLkegqM4bSgPXW9+UOZB3xUvcQntVFa0ErHa"
179  "GX+3ESOs06cpkB0acYdHABMxB+xTMGQEMHvDgsY9jBUMPHIICs4Fr6DCvqKOT7In"
180  "hxORZe+6kfkPiqWBSlA61OsEqMfdIs4oJgQwBKjH3SLOKCaLObVUFvBEfC+3feEH"
181  "3NKmLogOpT7rYtV8tDkCldvJlDq3hpb6UEwRBGEEHRxk8GjPRf+ipjqBt8E/a4hH"
182  "o+d+8U/j23/K/gy9EOjoJuA0NtZGqu+HsuJH1K8eir4ddSD5wqRcseuOlc/VUmK3"
183  "Cyn+7Fhk4ZwFT/mRKSgORkYhd5GBEUKCA0EmPFMVAjEAjLkegqM4bSgPXW9+UOZB"
184  "3xUvcQntVFazHxZubKwEJafPOrava3/DEDuIMgLpBGVlAgEB"
185  "-----END EC PARAMETERS-----";
186 
187  if(name == "brainpool512r1")
188  return
189  "-----BEGIN EC PARAMETERS-----"
190  "MIIBogIBATBMBgcqhkjOPQEBAkEAqt2duNvpxIs/1OauM8n8B8swjbOzydIO1mOc"
191  "ynAzCHF9TZsAm8ZoQq7NoSrmo4DmKIH/Ly2CxoUoqmBWWDpI8zCBhARAeDCjMYtg"
192  "O4niMnFFrCNMxZTL3Y09+RYQqDRByuqYY7wt7V1aqCU6oQou8cmLmsi1fxEXpyvy"
193  "x7nnwaxNd/yUygRAPfkWEKg0QcrqmGO8Le1dWqglOqEKLvHJi5rItX8RF6cr8se5"
194  "58GsTXf8lMrcCD5nmEBQt1665d0oCb1jgBb3IwSBgQSBruS92C7ZZFohMi6cTGqT"
195  "he2fcLXZFsG0O2Lu9NAJjv87H3ji0NSNUNFoe5O5fV98bVBHQGpeaIs1Igm8ufgi"
196  "fd44XVZjMuzA6r+pz3gi/fIJ9wAkpXsaoADFW4gfgRGy3N5JSl9IXlvKS9iKJ2Ou"
197  "0corL6jwVAZ4zR4POtgIkgJBAKrdnbjb6cSLP9TmrjPJ/AfLMI2zs8nSDtZjnMpw"
198  "MwhwVT5cQUypJhlBhmEZf6wQRx2x04EIXdrdtYeWgpypAGkCAQE="
199  "-----END EC PARAMETERS-----";
200 
201  if(name == "x962_p192v2")
202  return
203  "-----BEGIN EC PARAMETERS-----"
204  "MIGwAgEBMCQGByqGSM49AQECGQD////////////////////+//////////8wNAQY"
205  "/////////////////////v/////////8BBjMItbfuVxrJeScDWNkpOWYDDk6ohZo"
206  "2VMEMQTuorrn4Ul4QvLed2nP6cmJwHKtaW9IA0pldNEdabbsemcruCoIPfLysIR9"
207  "6XCy3hUCGQD///////////////5fsack3IBBhkjY3TECAQE="
208  "-----END EC PARAMETERS-----";
209 
210  if(name == "x962_p192v3")
211  return
212  "-----BEGIN EC PARAMETERS-----"
213  "MIGwAgEBMCQGByqGSM49AQECGQD////////////////////+//////////8wNAQY"
214  "/////////////////////v/////////8BBgiEj3COVoFyqdCPa7MyUdgp9RiJWvV"
215  "aRYEMQR9KXeBAMZaHaF4NxZYjc4ri0rujiKPGJY4qQ8iY3M3M0tJ3LZqbcj5l4rK"
216  "dkipQ7ACGQD///////////////96YtAxyD9ClPZA7BMCAQE="
217  "-----END EC PARAMETERS-----";
218 
219  if(name == "x962_p239v1")
220  return
221  "-----BEGIN EC PARAMETERS-----"
222  "MIHSAgEBMCkGByqGSM49AQECHn///////////////3///////4AAAAAAAH//////"
223  "/zBABB5///////////////9///////+AAAAAAAB///////wEHmsBbDvc8YlB0NZU"
224  "khR1ynGp2y+yfR03eWGFwpQsCgQ9BA/6ljzcqIFszDO4ZCvt+QXD01hXPT8n+707"
225  "PLmqr33r6OTpCl2ubkBUylMLoEZUs2gYziJrOfzLewLxrgIef///////////////"
226  "f///nl6an12QcfvRUiaIkJ0LAgEB"
227  "-----END EC PARAMETERS-----";
228 
229  if(name == "x962_p239v2")
230  return
231  "-----BEGIN EC PARAMETERS-----"
232  "MIHSAgEBMCkGByqGSM49AQECHn///////////////3///////4AAAAAAAH//////"
233  "/zBABB5///////////////9///////+AAAAAAAB///////wEHmF/q2gyV2y7/tUN"
234  "mfAknD/uWLlLoAOMeuhMjIMvLAQ9BDivCdmHJ3BRIMkhu16eJilqPNzy81dXoOr9"
235  "h7gw51sBJeTb6g7HIG2g/AHZsIEyn7VV3m70YCN9/4vkugIef///////////////"
236  "gAAAz6foWUN31BTAOCG8WCBjAgEB"
237  "-----END EC PARAMETERS-----";
238 
239  if(name == "x962_p239v3")
240  return
241  "-----BEGIN EC PARAMETERS-----"
242  "MIHSAgEBMCkGByqGSM49AQECHn///////////////3///////4AAAAAAAH//////"
243  "/zBABB5///////////////9///////+AAAAAAAB///////wEHiVXBfoqMGZUsfTL"
244  "A9anUKMMJQEC1JiHF9m6FattPgQ9BGdoro4Yu5LPzwBclJqixtlIU9DmYLv4VLHJ"
245  "UF/pWhYH5omPOQwGvB1VK60ibztvz+SLboGEma8Y4+1s8wIef///////////////"
246  "f///l13rQbOmBXw8QyFGUmVRAgEB"
247  "-----END EC PARAMETERS-----";
248 
249  if(name == "gost_256A")
250  return
251  "-----BEGIN EC PARAMETERS-----"
252  "MIHgAgEBMCwGByqGSM49AQECIQD/////////////////////////////////////"
253  "///9lzBEBCD////////////////////////////////////////9lAQgAAAAAAAA"
254  "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKYEQQQAAAAAAAAAAAAAAAAAAAAAAAAA"
255  "AAAAAAAAAAAAAAAAAY2R5HHgmJzaJ99QWkU/K3Y1KU8t3yPjsSKsyZyenx4UAiEA"
256  "/////////////////////2xhEHCZWtEARYQbCbdhuJMCAQE="
257  "-----END EC PARAMETERS-----";
258 
259  if(name == "frp256v1")
260  return
261  "-----BEGIN EC PARAMETERS-----"
262  "MIHgAgEBMCwGByqGSM49AQECIQDx/ReMCzrVjxASbejOQkNbOWGtvKvIym3o/PNT"
263  "2G6cAzBEBCDx/ReMCzrVjxASbejOQkNbOWGtvKvIym3o/PNT2G6cAAQg7jU/ylQo"
264  "qTANSrp1SkTAD9/sDJrksaGAMHXtlnt7tz8EQQS2s9TDVsE56zEYPUdJ1COVjCfS"
265  "3K+YtwFkyXot2Y9c/2FC4PfIsgSRH5Jx8PPs74wnAcMH6OTJ4YMRWhVUBiz7AiEA"
266  "8f0XjAs61Y8QEm3ozkJDW1PcZ+FA0r+UH/3UWcbWVeECAQE="
267  "-----END EC PARAMETERS-----";
268 
269  if(name == "sm2p256v1")
270  return
271  "-----BEGIN EC PARAMETERS-----"
272  "MIHgAgEBMCwGByqGSM49AQECIQD////+/////////////////////wAAAAD/////"
273  "/////zBEBCD////+/////////////////////wAAAAD//////////AQgKOn6np2f"
274  "XjRNWp5Lz2UJp/OXifUVq4+S3by9QU2UDpMEQQQyxK4sHxmBGV+ZBEZqOcmUj+ML"
275  "v/JmC+FxWkWJM0x0x7w3NqL09necWb3O42tpIVPQqYd8xipHQALfMuUhOfCgAiEA"
276  "/////v///////////////3ID32shxgUrU7v0CTnVQSMCAQE="
277  "-----END EC PARAMETERS-----";
278 
279 #if defined(BOTAN_HOUSE_ECC_CURVE_NAME)
280  if(name == BOTAN_HOUSE_ECC_CURVE_NAME)
281  return BOTAN_HOUSE_ECC_CURVE_PEM;
282 #endif
283 
284  return "";
285  }
286 
287 const std::set<std::string>& EC_Group::known_named_groups()
288  {
289  static const std::set<std::string> named_groups = {
290  "secp160k1",
291  "secp160r1",
292  "secp160r2",
293  "secp192k1",
294  "secp192r1",
295  "secp224k1",
296  "secp224r1",
297  "secp256k1",
298  "secp256r1",
299  "secp384r1",
300  "secp521r1",
301  "brainpool160r1",
302  "brainpool192r1",
303  "brainpool224r1",
304  "brainpool256r1",
305  "brainpool320r1",
306  "brainpool384r1",
307  "brainpool512r1",
308  "x962_p192v2",
309  "x962_p192v3",
310  "x962_p239v1",
311  "x962_p239v2",
312  "x962_p239v3",
313  "gost_256A",
314  "frp256v1",
315  "sm2p256v1"
316 #if defined(BOTAN_HOUSE_ECC_CURVE_NAME)
317  ,BOTAN_HOUSE_ECC_CURVE_NAME
318 #endif
319  };
320  return named_groups;
321  }
322 }
static const std::set< std::string > & known_named_groups()
Definition: ec_named.cpp:287
static std::string PEM_for_named_group(const std::string &name)
Definition: ec_named.cpp:13
Definition: alg_id.cpp:13