48122be51ea8b41edea7d7cbd851796ef50616bd
[moonshot-ui.git] / examples / service-selection.c
1 #include <libmoonshot.h>
2
3 #include <stdio.h>
4
5 int main (int argc, char *argv[])
6 {
7     MoonshotError *error = NULL;
8     int success;
9
10     char *nai,
11          *password,
12          *server_certificate_hash,
13          *ca_certificate,
14          *subject_name_constraint,
15          *subject_alt_name_constraint;
16
17     success = moonshot_get_identity ("",
18                                      "",
19                                      "email@project-moonshot.org",
20                                      &nai,
21                                      &password,
22                                      &server_certificate_hash,
23                                      &ca_certificate,
24                                      &subject_name_constraint,
25                                      &subject_alt_name_constraint,
26                                      &error);
27
28     if (success) {
29         printf ("Got identity: %s %s %s\n", nai, password, server_certificate_hash);
30
31         moonshot_free (nai);
32         moonshot_free (password);
33         moonshot_free (server_certificate_hash);
34         moonshot_free (ca_certificate);
35         moonshot_free (subject_name_constraint);
36         moonshot_free (subject_alt_name_constraint);
37
38         return 0;
39     } else {
40         printf ("Error: %s\n", error->message);
41         return 1;
42     }
43 }