- dead end implementation
[strongswan.git] / Source / charon / config / configuration_manager.c
1 /**
2 * @file configuration_manager.c
3 *
4 * @brief Implementation of configuration_manager_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #include <stdlib.h>
24
25 #include "configuration_manager.h"
26
27 #include <types.h>
28 #include <daemon.h>
29 #include <utils/allocator.h>
30
31
32 typedef struct preshared_secret_entry_t preshared_secret_entry_t;
33
34 /**
35 * A preshared secret entry combines an identifier and a
36 * preshared secret.
37 */
38 struct preshared_secret_entry_t {
39
40 /**
41 * Identification.
42 */
43 identification_t *identification;
44
45 /**
46 * Preshared secret as chunk_t. The NULL termination is not included.
47 */
48 chunk_t preshared_secret;
49 };
50
51
52 typedef struct rsa_private_key_entry_t rsa_private_key_entry_t;
53
54 /**
55 * Entry for a rsa private key.
56 */
57 struct rsa_private_key_entry_t {
58
59 /**
60 * Identification.
61 */
62 identification_t *identification;
63
64 /**
65 * Private key.
66 */
67 rsa_private_key_t* private_key;
68 };
69
70 typedef struct rsa_public_key_entry_t rsa_public_key_entry_t;
71
72 /**
73 * Entry for a rsa private key.
74 */
75 struct rsa_public_key_entry_t {
76
77 /**
78 * Identification.
79 */
80 identification_t *identification;
81
82 /**
83 * Private key.
84 */
85 rsa_public_key_t* public_key;
86 };
87
88 typedef struct configuration_entry_t configuration_entry_t;
89
90 /* A configuration entry combines a configuration name with a init and sa
91 * configuration represented as init_config_t and sa_config_t objects.
92 *
93 * @b Constructors:
94 * - configuration_entry_create()
95 */
96 struct configuration_entry_t {
97
98 /**
99 * Configuration name.
100 *
101 */
102 char *name;
103
104 /**
105 * Configuration for IKE_SA_INIT exchange.
106 */
107 init_config_t *init_config;
108
109 /**
110 * Configuration for all phases after IKE_SA_INIT exchange.
111 */
112 sa_config_t *sa_config;
113
114 /**
115 * Destroys a configuration_entry_t
116 *
117 * @param this calling object
118 */
119 void (*destroy) (configuration_entry_t *this);
120 };
121
122 /**
123 * Implementation of configuration_entry_t.destroy.
124 */
125 static void configuration_entry_destroy (configuration_entry_t *this)
126 {
127 allocator_free(this->name);
128 allocator_free(this);
129 }
130
131 /**
132 * @brief Creates a configuration_entry_t object.
133 *
134 * @param name name of the configuration entry (gets copied)
135 * @param init_config object of type init_config_t
136 * @param sa_config object of type sa_config_t
137 */
138 configuration_entry_t * configuration_entry_create(char * name, init_config_t * init_config, sa_config_t * sa_config)
139 {
140 configuration_entry_t *entry = allocator_alloc_thing(configuration_entry_t);
141
142 /* functions */
143 entry->destroy = configuration_entry_destroy;
144
145 /* private data */
146 entry->init_config = init_config;
147 entry->sa_config = sa_config;
148 entry->name = allocator_alloc(strlen(name) + 1);
149 strcpy(entry->name,name);
150 return entry;
151 }
152
153 typedef struct private_configuration_manager_t private_configuration_manager_t;
154
155 /**
156 * Private data of an configuration_manager_t object.
157 */
158 struct private_configuration_manager_t {
159
160 /**
161 * Public part of configuration_manager_t object.
162 */
163 configuration_manager_t public;
164
165 /**
166 * Holding all configurations.
167 */
168 linked_list_t *configurations;
169
170 /**
171 * Holding all managed init_configs.
172 */
173 linked_list_t *init_configs;
174
175 /**
176 * Holding all managed init_configs.
177 */
178 linked_list_t *sa_configs;
179
180 /**
181 * Holding all managed preshared secrets.
182 */
183 linked_list_t *preshared_secrets;
184
185 /**
186 * Holding all managed private secrets.
187 */
188 linked_list_t *rsa_private_keys;
189
190 /**
191 * Holding all managed public secrets.
192 */
193 linked_list_t *rsa_public_keys;
194
195 /**
196 * Assigned logger_t object.
197 */
198 logger_t *logger;
199
200 /**
201 * Max number of requests to be retransmitted.
202 * 0 for infinite.
203 */
204 u_int32_t max_retransmit_count;
205
206 /**
207 * First retransmit timeout in ms.
208 */
209 u_int32_t first_retransmit_timeout;
210
211 /**
212 * Timeout in ms after that time a IKE_SA gets deleted.
213 */
214 u_int32_t half_open_ike_sa_timeout;
215
216 /**
217 * Adds a new IKE_SA configuration.
218 *
219 * @param this calling object
220 * @param name name for the configuration
221 * @param init_config init_config_t object
222 * @param sa_config sa_config_t object
223 */
224 void (*add_new_configuration) (private_configuration_manager_t *this, char *name, init_config_t *init_config, sa_config_t *sa_config);
225
226 /**
227 * Adds a new preshared secret.
228 *
229 * @param this calling object
230 * @param type type of identification
231 * @param id_string identification as string
232 * @param preshared_secret preshared secret as string
233 */
234 void (*add_new_preshared_secret) (private_configuration_manager_t *this,id_type_t type, char *id_string, char *preshared_secret);
235
236 /**
237 * Adds a new rsa private key.
238 *
239 * @param this calling object
240 * @param type type of identification
241 * @param id_string identification as string
242 * @param key_pos location of key
243 * @param key_len length of key
244 */
245 void (*add_new_rsa_private_key) (private_configuration_manager_t *this,id_type_t type, char *id_string, u_int8_t *key_pos, size_t key_len);
246
247 /**
248 * Adds a new rsa public key.
249 *
250 * @param this calling object
251 * @param type type of identification
252 * @param id_string identification as string
253 * @param key_pos location of key
254 * @param key_len length of key
255 */
256 void (*add_new_rsa_public_key) (private_configuration_manager_t *this,id_type_t type, char *id_string, u_int8_t *key_pos, size_t key_len);
257
258 /**
259 * Load default configuration.
260 *
261 * @param this calling object
262 */
263 void (*load_default_config) (private_configuration_manager_t *this);
264 };
265
266
267 u_int8_t public_key_1[];
268 u_int8_t private_key_1[];
269 u_int8_t public_key_2[];
270 u_int8_t private_key_2[];
271
272 /**
273 * Implementation of private_configuration_manager_t.load_default_config.
274 */
275 static void load_default_config (private_configuration_manager_t *this)
276 {
277 init_config_t *init_config1, *init_config2, *init_config3, *init_config4, *init_config5;
278 ike_proposal_t proposals[4];
279 child_proposal_t *child_proposal;
280 sa_config_t *sa_config1, *sa_config2, *sa_config3, *sa_config4, *sa_config5;
281 traffic_selector_t *ts;
282
283 init_config1 = init_config_create("0.0.0.0","192.168.1.1",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
284 init_config2 = init_config_create("0.0.0.0","192.168.1.2",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
285 init_config3 = init_config_create("0.0.0.0","127.0.0.1",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
286 init_config4 = init_config_create("0.0.0.0","127.0.0.1",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
287 init_config5 = init_config_create("0.0.0.0","192.168.1.2",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
288 ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "0.0.0.0", 0, "255.255.255.255", 65535);
289
290
291 proposals[0].encryption_algorithm = ENCR_AES_CBC;
292 proposals[0].encryption_algorithm_key_length = 16;
293 proposals[0].integrity_algorithm = AUTH_HMAC_MD5_96;
294 proposals[0].integrity_algorithm_key_length = 16;
295 proposals[0].pseudo_random_function = PRF_HMAC_MD5;
296 proposals[0].pseudo_random_function_key_length = 16;
297 proposals[0].diffie_hellman_group = MODP_1024_BIT;
298
299 proposals[1] = proposals[0];
300 proposals[1].integrity_algorithm = AUTH_HMAC_SHA1_96;
301 proposals[1].integrity_algorithm_key_length = 20;
302 proposals[1].pseudo_random_function = PRF_HMAC_SHA1;
303 proposals[1].pseudo_random_function_key_length = 20;
304 proposals[1].diffie_hellman_group = MODP_2048_BIT;
305
306
307 proposals[2] = proposals[1];
308 proposals[2].diffie_hellman_group = MODP_4096_BIT;
309 proposals[3] = proposals[1];
310 proposals[3].diffie_hellman_group = MODP_2048_BIT;
311
312 init_config1->add_proposal(init_config1,1,proposals[1]);
313 init_config1->add_proposal(init_config1,1,proposals[0]);
314 init_config2->add_proposal(init_config2,1,proposals[1]);
315 init_config2->add_proposal(init_config2,1,proposals[0]);
316 init_config3->add_proposal(init_config3,1,proposals[1]);
317 init_config3->add_proposal(init_config3,1,proposals[0]);
318 init_config4->add_proposal(init_config4,1,proposals[3]);
319 init_config4->add_proposal(init_config4,1,proposals[2]);
320 init_config5->add_proposal(init_config5,1,proposals[3]);
321 init_config5->add_proposal(init_config5,1,proposals[2]);
322
323 sa_config1 = sa_config_create(ID_IPV4_ADDR, "192.168.1.2",
324 ID_IPV4_ADDR, "192.168.1.1",
325 SHARED_KEY_MESSAGE_INTEGRITY_CODE,
326 30000);
327
328 sa_config1->add_traffic_selector_initiator(sa_config1,ts);
329 sa_config1->add_traffic_selector_responder(sa_config1,ts);
330
331 sa_config2 = sa_config_create(ID_IPV4_ADDR, "192.168.1.1",
332 ID_IPV4_ADDR, "192.168.1.2",
333 SHARED_KEY_MESSAGE_INTEGRITY_CODE,
334 30000);
335
336 sa_config2->add_traffic_selector_initiator(sa_config2,ts);
337 sa_config2->add_traffic_selector_responder(sa_config2,ts);
338
339 sa_config3 = sa_config_create(ID_IPV4_ADDR, "192.168.1.1",
340 ID_IPV4_ADDR, "192.168.1.2",
341 SHARED_KEY_MESSAGE_INTEGRITY_CODE,
342 30000);
343
344 sa_config3->add_traffic_selector_initiator(sa_config3,ts);
345 sa_config3->add_traffic_selector_responder(sa_config3,ts);
346
347 sa_config4 = sa_config_create(ID_IPV4_ADDR, "127.0.0.1",
348 ID_IPV4_ADDR, "127.0.0.1",
349 RSA_DIGITAL_SIGNATURE,
350 30000);
351
352 sa_config4->add_traffic_selector_initiator(sa_config4,ts);
353 sa_config4->add_traffic_selector_responder(sa_config4,ts);
354
355 sa_config5 = sa_config_create(ID_IPV4_ADDR, "192.168.1.1",
356 ID_IPV4_ADDR, "192.168.1.2",
357 RSA_DIGITAL_SIGNATURE,
358 30000);
359
360 sa_config5->add_traffic_selector_initiator(sa_config5,ts);
361 sa_config5->add_traffic_selector_responder(sa_config5,ts);
362
363 ts->destroy(ts);
364
365 /* ah and esp prop */
366 child_proposal->add_algorithm(child_proposal, AH, INTEGRITY_ALGORITHM, AUTH_HMAC_SHA1_96, 20);
367 child_proposal->add_algorithm(child_proposal, AH, DIFFIE_HELLMAN_GROUP, MODP_1024_BIT, 0);
368 child_proposal->add_algorithm(child_proposal, AH, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
369
370 child_proposal->add_algorithm(child_proposal, ESP, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 16);
371 child_proposal->add_algorithm(child_proposal, ESP, INTEGRITY_ALGORITHM, AUTH_HMAC_SHA1_96, 20);
372 child_proposal->add_algorithm(child_proposal, ESP, DIFFIE_HELLMAN_GROUP, MODP_UNDEFINED, 0);
373 child_proposal->add_algorithm(child_proposal, ESP, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
374
375 sa_config1->add_proposal(sa_config1, child_proposal);
376 sa_config2->add_proposal(sa_config2, child_proposal);
377 sa_config3->add_proposal(sa_config3, child_proposal);
378 sa_config5->add_proposal(sa_config5, child_proposal);
379
380 this->add_new_configuration(this,"jan",init_config1,sa_config1);
381 this->add_new_configuration(this,"martin",init_config2,sa_config2);
382 this->add_new_configuration(this,"localhost-shared",init_config3,sa_config3);
383 this->add_new_configuration(this,"localhost-rsa",init_config3,sa_config4);
384 this->add_new_configuration(this,"localhost-bad_dh_group",init_config4, sa_config3);
385 this->add_new_configuration(this,"martin-bad_dh_group",init_config5, sa_config3);
386 this->add_new_configuration(this,"martin-rsa",init_config2, sa_config5);
387
388
389 this->add_new_preshared_secret(this,ID_IPV4_ADDR, "192.168.1.2","verschluesselt");
390 this->add_new_preshared_secret(this,ID_IPV4_ADDR, "192.168.1.1","verschluesselt");
391 this->add_new_preshared_secret(this,ID_IPV4_ADDR, "127.0.0.1","verschluesselt");
392
393 this->add_new_rsa_public_key(this,ID_IPV4_ADDR, "127.0.0.1", public_key_1, 256);
394 this->add_new_rsa_public_key(this,ID_IPV4_ADDR, "192.168.1.1", public_key_2, 256);
395 this->add_new_rsa_private_key(this,ID_IPV4_ADDR, "127.0.0.1", private_key_1, 1024);
396 this->add_new_rsa_private_key(this,ID_IPV4_ADDR, "192.168.1.1", private_key_2, 1024);
397 }
398
399 /**
400 * Implementation of configuration_manager_t.get_init_config_for_host.
401 */
402 static status_t get_init_config_for_host (private_configuration_manager_t *this, host_t *my_host, host_t *other_host,init_config_t **init_config)
403 {
404 iterator_t *iterator;
405 status_t status = NOT_FOUND;
406
407 iterator = this->configurations->create_iterator(this->configurations,TRUE);
408
409 this->logger->log(this->logger, CONTROL|LEVEL1, "getting config for hosts %s - %s",
410 my_host->get_address(my_host), other_host->get_address(other_host));
411
412 while (iterator->has_next(iterator))
413 {
414 configuration_entry_t *entry;
415 host_t *config_my_host;
416 host_t *config_other_host;
417
418 iterator->current(iterator,(void **) &entry);
419
420 config_my_host = entry->init_config->get_my_host(entry->init_config);
421 config_other_host = entry->init_config->get_other_host(entry->init_config);
422
423 /* first check if ip is equal */
424 if(config_other_host->ip_is_equal(config_other_host,other_host))
425 {
426 this->logger->log(this->logger, CONTROL|LEVEL2, "config entry with remote host %s",
427 config_other_host->get_address(config_other_host));
428 /* could be right one, check my_host for default route*/
429 if (config_my_host->is_default_route(config_my_host))
430 {
431 *init_config = entry->init_config;
432 status = SUCCESS;
433 break;
434 }
435 /* check now if host informations are the same */
436 else if (config_my_host->ip_is_equal(config_my_host,my_host))
437 {
438 *init_config = entry->init_config;
439 status = SUCCESS;
440 break;
441 }
442
443 }
444 /* Then check for wildcard hosts!
445 * TODO
446 * actually its only checked if other host with default route can be found! */
447 else if (config_other_host->is_default_route(config_other_host))
448 {
449 /* could be right one, check my_host for default route*/
450 if (config_my_host->is_default_route(config_my_host))
451 {
452 *init_config = entry->init_config;
453 status = SUCCESS;
454 break;
455 }
456 /* check now if host informations are the same */
457 else if (config_my_host->ip_is_equal(config_my_host,my_host))
458 {
459 *init_config = entry->init_config;
460 status = SUCCESS;
461 break;
462 }
463 }
464 }
465
466 iterator->destroy(iterator);
467
468 return status;
469 }
470
471 /**
472 * Implementation of configuration_manager_t.get_init_config_for_name.
473 */
474 static status_t get_init_config_for_name (private_configuration_manager_t *this, char *name, init_config_t **init_config)
475 {
476 iterator_t *iterator;
477 status_t status = NOT_FOUND;
478
479 iterator = this->configurations->create_iterator(this->configurations,TRUE);
480
481 while (iterator->has_next(iterator))
482 {
483 configuration_entry_t *entry;
484 iterator->current(iterator,(void **) &entry);
485
486 if (strcmp(entry->name,name) == 0)
487 {
488
489 /* found configuration */
490 *init_config = entry->init_config;
491 status = SUCCESS;
492 break;
493 }
494 }
495
496 iterator->destroy(iterator);
497
498 return status;
499 }
500
501 /**
502 * Implementation of configuration_manager_t.get_sa_config_for_name.
503 */
504 static status_t get_sa_config_for_name (private_configuration_manager_t *this, char *name, sa_config_t **sa_config)
505 {
506 iterator_t *iterator;
507 status_t status = NOT_FOUND;
508
509 iterator = this->configurations->create_iterator(this->configurations,TRUE);
510
511 while (iterator->has_next(iterator))
512 {
513 configuration_entry_t *entry;
514 iterator->current(iterator,(void **) &entry);
515
516 if (strcmp(entry->name,name) == 0)
517 {
518 /* found configuration */
519 *sa_config = entry->sa_config;
520 status = SUCCESS;
521 break;
522 }
523 }
524
525 iterator->destroy(iterator);
526
527 return status;
528 }
529
530 /**
531 * Implementation of configuration_manager_t.get_sa_config_for_init_config_and_id.
532 */
533 static status_t get_sa_config_for_init_config_and_id (private_configuration_manager_t *this, init_config_t *init_config, identification_t *other_id, identification_t *my_id,sa_config_t **sa_config)
534 {
535 iterator_t *iterator;
536 status_t status = NOT_FOUND;
537
538 iterator = this->configurations->create_iterator(this->configurations,TRUE);
539
540 while (iterator->has_next(iterator))
541 {
542 configuration_entry_t *entry;
543 iterator->current(iterator,(void **) &entry);
544
545 if (entry->init_config == init_config)
546 {
547 identification_t *config_my_id = entry->sa_config->get_my_id(entry->sa_config);
548 identification_t *config_other_id = entry->sa_config->get_other_id(entry->sa_config);
549
550 /* host informations seem to be the same */
551 if (config_other_id->equals(config_other_id,other_id))
552 {
553 /* other ids seems to match */
554
555 if (my_id == NULL)
556 {
557 /* first matching one is selected */
558
559 /* TODO priorize found entries */
560 *sa_config = entry->sa_config;
561 status = SUCCESS;
562 break;
563 }
564
565 if (config_my_id->equals(config_my_id,my_id))
566 {
567 *sa_config = entry->sa_config;
568 status = SUCCESS;
569 break;
570 }
571
572 }
573 }
574 }
575
576 iterator->destroy(iterator);
577
578 return status;
579 }
580
581 /**
582 * Implementation of private_configuration_manager_t.add_new_configuration.
583 */
584 static void add_new_configuration (private_configuration_manager_t *this, char *name, init_config_t *init_config, sa_config_t *sa_config)
585 {
586 iterator_t *iterator;
587 bool found;
588
589 iterator = this->init_configs->create_iterator(this->init_configs,TRUE);
590 found = FALSE;
591 while (iterator->has_next(iterator))
592 {
593 init_config_t *found_init_config;
594 iterator->current(iterator,(void **) &found_init_config);
595 if (init_config == found_init_config)
596 {
597 found = TRUE;
598 break;
599 }
600 }
601 iterator->destroy(iterator);
602 if (!found)
603 {
604 this->init_configs->insert_first(this->init_configs,init_config);
605 }
606
607 iterator = this->sa_configs->create_iterator(this->sa_configs,TRUE);
608 found = FALSE;
609 while (iterator->has_next(iterator))
610 {
611 sa_config_t *found_sa_config;
612 iterator->current(iterator,(void **) &found_sa_config);
613 if (sa_config == found_sa_config)
614 {
615 found = TRUE;
616 break;
617 }
618 }
619 iterator->destroy(iterator);
620 if (!found)
621 {
622 this->sa_configs->insert_first(this->sa_configs,sa_config);
623 }
624
625 this->configurations->insert_last(this->configurations,configuration_entry_create(name,init_config,sa_config));
626 }
627
628 /**
629 * Implementation of private_configuration_manager_t.add_new_preshared_secret.
630 */
631 static void add_new_preshared_secret (private_configuration_manager_t *this,id_type_t type, char *id_string, char *preshared_secret)
632 {
633 preshared_secret_entry_t *entry = allocator_alloc_thing(preshared_secret_entry_t);
634
635 entry->identification = identification_create_from_string(type,id_string);
636 entry->preshared_secret.len = strlen(preshared_secret) + 1;
637 entry->preshared_secret.ptr = allocator_alloc(entry->preshared_secret.len);
638 memcpy(entry->preshared_secret.ptr,preshared_secret,entry->preshared_secret.len);
639
640 this->preshared_secrets->insert_last(this->preshared_secrets,entry);
641 }
642
643 /**
644 * Implementation of private_configuration_manager_t.add_new_preshared_secret.
645 */
646 static void add_new_rsa_public_key (private_configuration_manager_t *this, id_type_t type, char *id_string, u_int8_t* key_pos, size_t key_len)
647 {
648 chunk_t key;
649 key.ptr = key_pos;
650 key.len = key_len;
651
652 rsa_public_key_entry_t *entry = allocator_alloc_thing(rsa_public_key_entry_t);
653
654 entry->identification = identification_create_from_string(type,id_string);
655 entry->public_key = rsa_public_key_create();
656 entry->public_key->set_key(entry->public_key, key);
657
658 this->rsa_public_keys->insert_last(this->rsa_public_keys, entry);
659 }
660
661 /**
662 * Implementation of private_configuration_manager_t.add_new_preshared_secret.
663 */
664 static void add_new_rsa_private_key (private_configuration_manager_t *this, id_type_t type, char *id_string, u_int8_t* key_pos, size_t key_len)
665 {
666 chunk_t key;
667 key.ptr = key_pos;
668 key.len = key_len;
669
670 rsa_private_key_entry_t *entry = allocator_alloc_thing(rsa_private_key_entry_t);
671
672 entry->identification = identification_create_from_string(type,id_string);
673 entry->private_key = rsa_private_key_create();
674 entry->private_key->set_key(entry->private_key, key);
675
676 this->rsa_private_keys->insert_last(this->rsa_private_keys, entry);
677 }
678
679 /**
680 * Implementation of configuration_manager_t.get_shared_secret.
681 */
682 static status_t get_shared_secret(private_configuration_manager_t *this, identification_t *identification, chunk_t *preshared_secret)
683 {
684 iterator_t *iterator;
685
686 iterator = this->preshared_secrets->create_iterator(this->preshared_secrets,TRUE);
687 while (iterator->has_next(iterator))
688 {
689 preshared_secret_entry_t *entry;
690 iterator->current(iterator,(void **) &entry);
691 if (entry->identification->equals(entry->identification,identification))
692 {
693 *preshared_secret = entry->preshared_secret;
694 iterator->destroy(iterator);
695 return SUCCESS;
696 }
697 }
698 iterator->destroy(iterator);
699 return NOT_FOUND;
700 }
701
702 /**
703 * Implementation of configuration_manager_t.get_shared_secret.
704 */
705 static status_t get_rsa_public_key(private_configuration_manager_t *this, identification_t *identification, rsa_public_key_t **public_key)
706 {
707 iterator_t *iterator;
708
709 iterator = this->rsa_public_keys->create_iterator(this->rsa_public_keys,TRUE);
710 while (iterator->has_next(iterator))
711 {
712 rsa_public_key_entry_t *entry;
713 iterator->current(iterator,(void **) &entry);
714 if (entry->identification->equals(entry->identification,identification))
715 {
716 *public_key = entry->public_key;
717 iterator->destroy(iterator);
718 return SUCCESS;
719 }
720 }
721 iterator->destroy(iterator);
722 return NOT_FOUND;
723 }
724
725 /**
726 * Implementation of configuration_manager_t.get_shared_secret.
727 */
728 static status_t get_rsa_private_key(private_configuration_manager_t *this, identification_t *identification, rsa_private_key_t **private_key)
729 {
730 iterator_t *iterator;
731
732 iterator = this->rsa_private_keys->create_iterator(this->rsa_private_keys,TRUE);
733 while (iterator->has_next(iterator))
734 {
735 rsa_private_key_entry_t *entry;
736 iterator->current(iterator,(void **) &entry);
737 if (entry->identification->equals(entry->identification,identification))
738 {
739 *private_key = entry->private_key;
740 iterator->destroy(iterator);
741 return SUCCESS;
742 }
743 }
744 iterator->destroy(iterator);
745 return NOT_FOUND;
746 }
747
748 /**
749 * Implementation of configuration_manager_t.get_retransmit_timeout.
750 */
751 static status_t get_retransmit_timeout (private_configuration_manager_t *this, u_int32_t retransmit_count, u_int32_t *timeout)
752 {
753 int new_timeout = this->first_retransmit_timeout, i;
754 if ((retransmit_count > this->max_retransmit_count) && (this->max_retransmit_count != 0))
755 {
756 return FAILED;
757 }
758
759
760 for (i = 0; i < retransmit_count; i++)
761 {
762 new_timeout *= 2;
763 }
764
765 *timeout = new_timeout;
766
767 return SUCCESS;
768 }
769
770 /**
771 * Implementation of configuration_manager_t.get_half_open_ike_sa_timeout.
772 */
773 static u_int32_t get_half_open_ike_sa_timeout (private_configuration_manager_t *this)
774 {
775 return this->half_open_ike_sa_timeout;
776 }
777
778 /**
779 * Implementation of configuration_manager_t.destroy.
780 */
781 static void destroy(private_configuration_manager_t *this)
782 {
783 this->logger->log(this->logger,CONTROL | LEVEL1, "Going to destroy configuration manager ");
784
785 this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy configuration entries");
786 while (this->configurations->get_count(this->configurations) > 0)
787 {
788 configuration_entry_t *entry;
789 this->configurations->remove_first(this->configurations,(void **) &entry);
790 entry->destroy(entry);
791 }
792 this->configurations->destroy(this->configurations);
793
794 this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy sa_config_t objects");
795 while (this->sa_configs->get_count(this->sa_configs) > 0)
796 {
797 sa_config_t *sa_config;
798 this->sa_configs->remove_first(this->sa_configs,(void **) &sa_config);
799 sa_config->destroy(sa_config);
800 }
801
802 this->sa_configs->destroy(this->sa_configs);
803
804 this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy init_config_t objects");
805 while (this->init_configs->get_count(this->init_configs) > 0)
806 {
807 init_config_t *init_config;
808 this->init_configs->remove_first(this->init_configs,(void **) &init_config);
809 init_config->destroy(init_config);
810 }
811 this->init_configs->destroy(this->init_configs);
812
813 while (this->preshared_secrets->get_count(this->preshared_secrets) > 0)
814 {
815 preshared_secret_entry_t *entry;
816 this->preshared_secrets->remove_first(this->preshared_secrets,(void **) &entry);
817 entry->identification->destroy(entry->identification);
818 allocator_free_chunk(&(entry->preshared_secret));
819 allocator_free(entry);
820 }
821 this->preshared_secrets->destroy(this->preshared_secrets);
822
823 this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy rsa private keys");
824 while (this->rsa_private_keys->get_count(this->rsa_private_keys) > 0)
825 {
826 rsa_private_key_entry_t *entry;
827 this->rsa_private_keys->remove_first(this->rsa_private_keys,(void **) &entry);
828 entry->identification->destroy(entry->identification);
829 entry->private_key->destroy(entry->private_key);
830 allocator_free(entry);
831 }
832 this->rsa_private_keys->destroy(this->rsa_private_keys);
833
834 this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy rsa public keys");
835 while (this->rsa_public_keys->get_count(this->rsa_public_keys) > 0)
836 {
837 rsa_public_key_entry_t *entry;
838 this->rsa_public_keys->remove_first(this->rsa_public_keys,(void **) &entry);
839 entry->identification->destroy(entry->identification);
840 entry->public_key->destroy(entry->public_key);
841 allocator_free(entry);
842 }
843 this->rsa_public_keys->destroy(this->rsa_public_keys);
844
845 this->logger->log(this->logger,CONTROL | LEVEL2, "Destroy assigned logger");
846 charon->logger_manager->destroy_logger(charon->logger_manager,this->logger);
847 allocator_free(this);
848 }
849
850 /*
851 * Described in header-file
852 */
853 configuration_manager_t *configuration_manager_create(u_int32_t first_retransmit_timeout,u_int32_t max_retransmit_count, u_int32_t half_open_ike_sa_timeout)
854 {
855 private_configuration_manager_t *this = allocator_alloc_thing(private_configuration_manager_t);
856
857 /* public functions */
858 this->public.destroy = (void(*)(configuration_manager_t*))destroy;
859 this->public.get_init_config_for_name = (status_t (*) (configuration_manager_t *, char *, init_config_t **)) get_init_config_for_name;
860 this->public.get_init_config_for_host = (status_t (*) (configuration_manager_t *, host_t *, host_t *,init_config_t **)) get_init_config_for_host;
861 this->public.get_sa_config_for_name =(status_t (*) (configuration_manager_t *, char *, sa_config_t **)) get_sa_config_for_name;
862 this->public.get_sa_config_for_init_config_and_id =(status_t (*) (configuration_manager_t *, init_config_t *, identification_t *, identification_t *,sa_config_t **)) get_sa_config_for_init_config_and_id;
863 this->public.get_retransmit_timeout = (status_t (*) (configuration_manager_t *, u_int32_t retransmit_count, u_int32_t *timeout))get_retransmit_timeout;
864 this->public.get_half_open_ike_sa_timeout = (u_int32_t (*) (configuration_manager_t *)) get_half_open_ike_sa_timeout;
865 this->public.get_shared_secret = (status_t (*) (configuration_manager_t *, identification_t *, chunk_t *))get_shared_secret;
866 this->public.get_rsa_private_key = (status_t (*) (configuration_manager_t *, identification_t *, rsa_private_key_t**))get_rsa_private_key;
867 this->public.get_rsa_public_key = (status_t (*) (configuration_manager_t *, identification_t *, rsa_public_key_t**))get_rsa_public_key;
868
869 /* private functions */
870 this->load_default_config = load_default_config;
871 this->add_new_configuration = add_new_configuration;
872 this->add_new_preshared_secret = add_new_preshared_secret;
873 this->add_new_rsa_public_key = add_new_rsa_public_key;
874 this->add_new_rsa_private_key = add_new_rsa_private_key;
875
876 /* private variables */
877 this->logger = charon->logger_manager->create_logger(charon->logger_manager,CONFIGURATION_MANAGER,NULL);
878 this->configurations = linked_list_create();
879 this->sa_configs = linked_list_create();
880 this->init_configs = linked_list_create();
881 this->preshared_secrets = linked_list_create();
882 this->rsa_private_keys = linked_list_create();
883 this->rsa_public_keys = linked_list_create();
884 this->max_retransmit_count = max_retransmit_count;
885 this->first_retransmit_timeout = first_retransmit_timeout;
886 this->half_open_ike_sa_timeout = half_open_ike_sa_timeout;
887
888 this->load_default_config(this);
889
890 return (&this->public);
891 }
892
893
894 u_int8_t public_key_1[] = {
895 0xD4,0x8D,0x40,0x8E,0xBD,0xFC,0x6D,0xE9,0xDB,0x1C,0xD2,0x21,0x19,0x37,0x6B,0xE2,
896 0xDC,0xCE,0x74,0xA2,0x63,0xF6,0xD8,0x8D,0xAF,0x1C,0xC0,0xFF,0x07,0x3F,0xFB,0x52,
897 0x59,0x45,0x01,0x10,0x35,0xA9,0xB8,0x16,0x69,0x31,0x19,0x4F,0xDD,0x66,0xAD,0xAC,
898 0x80,0x11,0x33,0x38,0x5A,0x11,0xF9,0x33,0x3F,0xD2,0x41,0x4A,0x21,0x9B,0x54,0x44,
899 0x00,0xB6,0x07,0x33,0x4A,0x5B,0x4E,0x09,0x7C,0x9D,0xB8,0xDE,0x6B,0xA2,0xB2,0x78,
900 0x23,0x3D,0xF0,0xB7,0x37,0x2B,0x7A,0x71,0x50,0x6E,0xEA,0x93,0x3E,0xB5,0x2C,0xBD,
901 0xD6,0x08,0x43,0x12,0x0A,0xE8,0x8D,0xE6,0x6C,0x24,0xCC,0x3F,0xF7,0x18,0x7E,0x87,
902 0x59,0x0C,0xA9,0x5D,0x85,0xF8,0x6E,0x83,0xD8,0x18,0x77,0x07,0xB6,0x44,0x3C,0x8D,
903 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
904 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
905 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
906 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
907 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
908 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
909 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
910 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01
911 };
912
913 u_int8_t private_key_1[] = {
914 0xD4,0x8D,0x40,0x8E,0xBD,0xFC,0x6D,0xE9,0xDB,0x1C,0xD2,0x21,0x19,0x37,0x6B,0xE2,
915 0xDC,0xCE,0x74,0xA2,0x63,0xF6,0xD8,0x8D,0xAF,0x1C,0xC0,0xFF,0x07,0x3F,0xFB,0x52,
916 0x59,0x45,0x01,0x10,0x35,0xA9,0xB8,0x16,0x69,0x31,0x19,0x4F,0xDD,0x66,0xAD,0xAC,
917 0x80,0x11,0x33,0x38,0x5A,0x11,0xF9,0x33,0x3F,0xD2,0x41,0x4A,0x21,0x9B,0x54,0x44,
918 0x00,0xB6,0x07,0x33,0x4A,0x5B,0x4E,0x09,0x7C,0x9D,0xB8,0xDE,0x6B,0xA2,0xB2,0x78,
919 0x23,0x3D,0xF0,0xB7,0x37,0x2B,0x7A,0x71,0x50,0x6E,0xEA,0x93,0x3E,0xB5,0x2C,0xBD,
920 0xD6,0x08,0x43,0x12,0x0A,0xE8,0x8D,0xE6,0x6C,0x24,0xCC,0x3F,0xF7,0x18,0x7E,0x87,
921 0x59,0x0C,0xA9,0x5D,0x85,0xF8,0x6E,0x83,0xD8,0x18,0x77,0x07,0xB6,0x44,0x3C,0x8D,
922 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
923 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
924 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
925 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
926 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
927 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
928 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
929 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,
930 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
931 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
932 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
933 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
934 0xEE,0xF2,0x37,0xF2,0x98,0xEB,0x33,0xC6,0x84,0xE8,0xB9,0xD1,0x18,0xB5,0x29,0x00,
935 0xAC,0x6B,0x78,0xBC,0x9E,0xB6,0x01,0x21,0x29,0xEE,0x4A,0x99,0xFB,0x3D,0x07,0x23,
936 0x77,0x84,0x93,0x4B,0x53,0x49,0xB0,0xA4,0x6F,0xB0,0xF5,0x50,0xDB,0x35,0xDD,0xDF,
937 0x41,0x6F,0x7B,0xA9,0x88,0x3D,0x0B,0x1C,0x2E,0x2B,0x44,0x35,0x24,0x72,0x66,0xC1,
938 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
939 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
940 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
941 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
942 0xE3,0xB8,0xC8,0x30,0x67,0xD0,0x5D,0xF1,0x32,0x64,0xDC,0x4B,0xB3,0x7E,0xE3,0x1A,
943 0xC5,0xBC,0xAC,0xC9,0x95,0x5C,0x96,0x0D,0x5A,0x52,0x90,0xE0,0x08,0x3F,0xA6,0x71,
944 0xC7,0x18,0xC5,0x64,0xA2,0xE4,0xB8,0x43,0x5A,0x8A,0x7A,0x9B,0xDF,0xDA,0x81,0x85,
945 0x6C,0x0F,0xA4,0xC9,0xAC,0x25,0x19,0x54,0xFE,0x75,0xAA,0x1D,0x22,0xB8,0xF4,0xCD,
946 0x1A,0x91,0xC2,0xA3,0x65,0x3F,0xD7,0xFC,0x7E,0xE1,0x92,0x29,0xC5,0x85,0x6E,0x44,
947 0xC8,0x4D,0xBD,0x7A,0x2C,0x2D,0x47,0xE2,0x24,0x24,0xDF,0xC2,0x31,0x65,0x8F,0xD4,
948 0xBA,0x28,0x7C,0x4A,0xCA,0xAE,0x79,0xBE,0xC1,0x6C,0xFC,0x09,0x45,0xF7,0x87,0x17,
949 0xB4,0x55,0x92,0x15,0xC5,0xFA,0x8F,0xB0,0x56,0x96,0xC1,0x87,0x12,0xFE,0xDF,0xF0,
950 0x3A,0xE1,0xB1,0x83,0x19,0x74,0xF0,0x7D,0x37,0x41,0x3E,0x6A,0xFE,0x33,0x3E,0x74,
951 0x01,0x45,0xE4,0x65,0xAE,0xC9,0xAE,0x64,0xE3,0xF1,0x90,0xFD,0x1A,0x30,0x44,0x82,
952 0xEE,0x34,0x94,0xF2,0x68,0x3D,0x61,0x90,0xFB,0xEB,0xD8,0x18,0xE6,0x7C,0xEC,0x69,
953 0x70,0xD0,0xEB,0x2F,0xC1,0x3D,0x9C,0x6A,0x4B,0x89,0x50,0x6B,0x3F,0xA5,0x38,0x41,
954 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
955 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
956 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
957 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
958 0x65,0xEE,0x34,0x09,0xAC,0x4C,0x21,0x71,0x1D,0x3F,0x7E,0x0D,0x01,0xC2,0x3E,0x34,
959 0x88,0x58,0xEC,0x4F,0x62,0x50,0xF7,0xD8,0x62,0xDF,0xC1,0x39,0x40,0xA0,0xBF,0x0B,
960 0xD5,0x2F,0x5B,0xFA,0x35,0x14,0x69,0x63,0x2C,0x36,0x4B,0xDF,0xEB,0x33,0x66,0x6B,
961 0x97,0xA9,0x6C,0x12,0x5D,0x08,0xD5,0x55,0x77,0x28,0x83,0xD7,0x3B,0xAE,0x05,0xC1,
962 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
963 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
964 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
965 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
966 0x9F,0x96,0x17,0x75,0x14,0xCB,0xC9,0x8A,0x06,0xAE,0xF8,0x53,0x74,0xEF,0x2F,0x68,
967 0xCB,0xBA,0x75,0xBC,0xAF,0x97,0xBA,0xF0,0x90,0xA3,0xDC,0x33,0xA4,0x94,0x36,0xA8,
968 0xF5,0xC6,0x3E,0x4F,0x50,0x78,0xC9,0x49,0x2A,0x62,0x71,0x9A,0x5B,0x3E,0x5E,0x16,
969 0x8A,0xAC,0x4B,0xE7,0xA9,0x64,0x36,0x64,0x82,0x0F,0x23,0xB0,0x57,0x6D,0x16,0xE1,
970 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
971 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
972 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
973 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
974 0x25,0xF1,0x40,0x05,0x58,0x19,0x37,0x61,0x34,0x98,0xBB,0x29,0x1B,0x44,0x08,0x1A,
975 0xD3,0x66,0x62,0x4C,0x9C,0x47,0xD2,0x91,0x60,0x46,0x6F,0x8E,0xA6,0xE7,0x80,0x7B,
976 0x17,0x77,0x9A,0xB5,0x18,0x8A,0x15,0x8F,0x77,0xA1,0x55,0x3E,0x96,0x66,0x86,0x57,
977 0x75,0x73,0xF5,0x57,0x50,0x28,0xEA,0x83,0x14,0xB1,0x55,0xA3,0x82,0xCD,0x36,0xF8
978 };
979 u_int8_t public_key_2[] = {
980 0x88,0x3E,0xE2,0x2E,0x5D,0x01,0x13,0xDF,0x1D,0x8B,0xF4,0x39,0xCA,0xE6,0x3C,0xE1,
981 0x46,0x8E,0xD4,0xF1,0x06,0x56,0x12,0x8D,0xCD,0x51,0xBD,0x32,0xF5,0x18,0x15,0x4D,
982 0x0F,0x98,0xDF,0xFF,0xA5,0xA3,0xAB,0x39,0x43,0xC4,0xF6,0xAC,0x98,0x5C,0x84,0x63,
983 0x8C,0x46,0x33,0xA2,0x23,0x8C,0xF0,0x4D,0xFE,0xE7,0xF3,0x38,0xC4,0x19,0x39,0xC4,
984 0x90,0xF4,0xC8,0x0D,0xB0,0xFE,0x65,0x11,0x0B,0x41,0x73,0xBB,0x05,0xA6,0x4B,0xC5,
985 0x27,0xA4,0x48,0x21,0xC5,0xAE,0x91,0x9C,0xD8,0x62,0x27,0xBE,0xDF,0xDA,0xC6,0x4E,
986 0xC1,0x6E,0x5B,0x61,0x51,0xAA,0xC9,0x53,0xCD,0x02,0x5B,0xC5,0xEE,0xE9,0xC7,0x7B,
987 0xB1,0x7E,0xD2,0xC2,0xFE,0x5F,0xD7,0x0F,0x75,0x2B,0xB9,0x49,0x5F,0x35,0xF1,0x83,
988 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
989 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
990 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
991 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
992 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
993 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
994 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
995 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01
996 };
997 u_int8_t private_key_2[] = {
998 0x88,0x3E,0xE2,0x2E,0x5D,0x01,0x13,0xDF,0x1D,0x8B,0xF4,0x39,0xCA,0xE6,0x3C,0xE1,
999 0x46,0x8E,0xD4,0xF1,0x06,0x56,0x12,0x8D,0xCD,0x51,0xBD,0x32,0xF5,0x18,0x15,0x4D,
1000 0x0F,0x98,0xDF,0xFF,0xA5,0xA3,0xAB,0x39,0x43,0xC4,0xF6,0xAC,0x98,0x5C,0x84,0x63,
1001 0x8C,0x46,0x33,0xA2,0x23,0x8C,0xF0,0x4D,0xFE,0xE7,0xF3,0x38,0xC4,0x19,0x39,0xC4,
1002 0x90,0xF4,0xC8,0x0D,0xB0,0xFE,0x65,0x11,0x0B,0x41,0x73,0xBB,0x05,0xA6,0x4B,0xC5,
1003 0x27,0xA4,0x48,0x21,0xC5,0xAE,0x91,0x9C,0xD8,0x62,0x27,0xBE,0xDF,0xDA,0xC6,0x4E,
1004 0xC1,0x6E,0x5B,0x61,0x51,0xAA,0xC9,0x53,0xCD,0x02,0x5B,0xC5,0xEE,0xE9,0xC7,0x7B,
1005 0xB1,0x7E,0xD2,0xC2,0xFE,0x5F,0xD7,0x0F,0x75,0x2B,0xB9,0x49,0x5F,0x35,0xF1,0x83,
1006 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1007 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1008 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1009 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1010 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1011 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1012 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1013 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,
1014 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1015 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1016 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1017 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1018 0xE8,0x37,0xB6,0x08,0xD8,0x9C,0x72,0xC5,0x34,0xDB,0x3A,0xA2,0xF9,0x24,0xE1,0x44,
1019 0x23,0x3B,0x72,0x70,0x5D,0xCC,0xC3,0xBA,0x3D,0xCE,0x82,0xAC,0x6A,0x71,0x72,0x90,
1020 0xC7,0x94,0xB3,0x8B,0x85,0xE0,0xEF,0x39,0xF0,0xE4,0x08,0x31,0xEA,0xE6,0x3B,0x7D,
1021 0xB0,0x36,0xFA,0x71,0x6E,0xA3,0xF9,0x4C,0x39,0x05,0x8C,0xB7,0x8C,0x99,0x94,0x85,
1022 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1023 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1024 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1025 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1026 0x96,0x32,0xF9,0xD9,0xA8,0xC0,0x84,0xFD,0xE5,0x6B,0xA6,0xC2,0x85,0x85,0x68,0x17,
1027 0x7E,0x98,0xD0,0x6A,0xDC,0xD8,0x4C,0x46,0xCB,0x6D,0x4C,0x25,0xE5,0xF9,0x58,0xB2,
1028 0x17,0xE4,0x20,0x8A,0x87,0x0D,0xD7,0x4C,0x79,0xA3,0xB3,0x69,0x98,0x7F,0x5D,0x08,
1029 0x33,0x5B,0xAD,0xA3,0x34,0xE8,0x55,0x5E,0x09,0x60,0x70,0xA8,0x11,0xFD,0x70,0x67,
1030 0x00,0xE1,0xA7,0x44,0xF5,0x85,0x14,0x43,0xD5,0x45,0x1A,0x87,0x65,0x30,0xA8,0x24,
1031 0x2C,0xF8,0xAF,0x97,0xFF,0x9A,0x7E,0xF4,0x3B,0xE7,0xD3,0x79,0x88,0xEC,0x66,0xF6,
1032 0xE0,0xAA,0xF4,0x88,0x0A,0xE2,0x4C,0x31,0x4A,0xA6,0xF3,0x91,0x9A,0x4A,0xBE,0xF0,
1033 0x85,0xEF,0xCE,0x55,0xB6,0x35,0x2B,0x38,0xD5,0xF5,0x5A,0x35,0x7B,0xCF,0x4D,0xF8,
1034 0x5D,0x1E,0x57,0x99,0xAF,0xED,0x33,0x6F,0xD5,0xA7,0x49,0x5B,0x14,0x4C,0x7D,0x17,
1035 0x81,0xAE,0x1E,0xDA,0x9D,0xFB,0xA9,0xC3,0x00,0x4C,0x17,0x37,0x30,0x96,0x60,0xE1,
1036 0x6A,0xCC,0xD3,0xDB,0x40,0xCE,0x96,0x96,0x0D,0x95,0x0D,0x84,0x38,0xBD,0xDA,0x2F,
1037 0xEC,0xED,0x22,0x39,0x8E,0x8C,0xDF,0xCD,0x07,0xCF,0x0F,0xB0,0x2B,0x76,0xDB,0xC1,
1038 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1039 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1040 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1041 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1042 0xA5,0x37,0x9E,0x08,0x45,0x35,0x6A,0x62,0xEC,0xEC,0x5D,0x97,0xBE,0x73,0x82,0xE2,
1043 0x9B,0xBE,0x9B,0xF9,0x5E,0x83,0x65,0x6E,0x88,0xB2,0xF9,0x3D,0xFA,0xAD,0xA4,0xB9,
1044 0x65,0x86,0x63,0x08,0x0D,0xC4,0xAF,0xF0,0x25,0x77,0xD8,0x6C,0xCB,0x97,0xEB,0x13,
1045 0xCD,0xE0,0x0F,0xE7,0xCC,0xB4,0x55,0x96,0xE9,0xAB,0x0D,0x27,0x3A,0x9D,0xBA,0x91,
1046 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1047 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1048 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1049 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1050 0x44,0xA3,0x44,0xF4,0x47,0x9E,0xBA,0xE7,0xBF,0xF8,0xC2,0xFB,0x2F,0xC3,0x38,0x3F,
1051 0x4C,0x56,0x0F,0x20,0x56,0x8D,0xED,0xC5,0x88,0x5F,0x09,0x26,0x64,0x82,0xDF,0x1A,
1052 0x7B,0xBA,0x7F,0x78,0x6E,0xA1,0x4F,0x9B,0x1E,0x17,0x45,0xFC,0xE2,0x78,0x89,0x8E,
1053 0x1E,0xD2,0x2D,0x76,0x60,0xCE,0x2F,0x7C,0xCA,0xB2,0x2C,0xA9,0x51,0x97,0x4C,0xCF,
1054 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1055 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1056 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1057 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1058 0x01,0x40,0x4B,0x7D,0xAB,0x8A,0xB9,0x5E,0xEE,0xA1,0x81,0xED,0x27,0x89,0xF6,0x4C,
1059 0x59,0x8C,0x23,0x14,0x3B,0x1B,0xBA,0xC3,0xB2,0x00,0x9A,0x9E,0xDF,0x54,0x82,0xA7,
1060 0x3E,0xC9,0x23,0x85,0x4D,0xD3,0x80,0xA7,0x89,0x11,0xBA,0x76,0xF5,0xC1,0x55,0x37,
1061 0x0A,0x0D,0x8C,0x07,0x0A,0xC8,0xC5,0x11,0x74,0x9C,0xB6,0x80,0x3B,0x0A,0x9A,0xA2
1062 };