NO_CREDENTIAL_FACTORY compile option not needed anymore
[strongswan.git] / scripts / id2sql.c
1
2 #include <stdio.h>
3 #include <utils/identification.h>
4
5 /**
6 * convert an identity to type and encoding
7 */
8 int main(int argc, char *argv[])
9 {
10 identification_t *id;
11 chunk_t enc;
12 int i;
13
14 if (argc < 2)
15 {
16 return -1;
17 }
18
19 id = identification_create_from_string(argv[1]);
20 if (!id)
21 {
22 return -2;
23 }
24 printf("type\tencoding\n");
25 printf("%d,\t", id->get_type(id));
26 enc = id->get_encoding(id);
27
28 printf("X'");
29 for (i = 0; i < enc.len; i++)
30 {
31 printf("%02x", (unsigned int)enc.ptr[i]);
32 }
33 printf("'\n");
34 return 0;
35 }
36