2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
3 * Software Foundation, Inc.
5 * This file is part of GNUTLS.
7 * GNUTLS is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * GNUTLS is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see
19 * <http://www.gnu.org/licenses/>.
21 * Written by Nikos Mavrogiannopoulos <nmav@gnutls.org>.
28 #include <certtool-cfg.h>
30 #include <gnutls/x509.h>
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <arpa/inet.h>
41 /* Gnulib portability files. */
44 #include "certtool-common.h"
48 typedef struct _cfg_ctx
56 char *challenge_password
;
63 char *crl_dist_points
;
65 char *pkcs12_key_name
;
78 int time_stamping_key
;
79 char **key_purpose_oids
;
83 char *proxy_policy_language
;
91 memset (&cfg
, 0, sizeof (cfg
));
97 template_parse (const char *template)
99 /* libcfg+ parsing context */
102 /* Parsing return code */
105 /* Option variables */
108 struct cfg_option options
[] = {
109 {NULL
, '\0', "organization", CFG_STR
, (void *) &cfg
.organization
,
111 {NULL
, '\0', "unit", CFG_STR
, (void *) &cfg
.unit
, 0},
112 {NULL
, '\0', "locality", CFG_STR
, (void *) &cfg
.locality
, 0},
113 {NULL
, '\0', "state", CFG_STR
, (void *) &cfg
.state
, 0},
114 {NULL
, '\0', "cn", CFG_STR
, (void *) &cfg
.cn
, 0},
115 {NULL
, '\0', "uid", CFG_STR
, (void *) &cfg
.uid
, 0},
116 {NULL
, '\0', "challenge_password", CFG_STR
,
117 (void *) &cfg
.challenge_password
, 0},
118 {NULL
, '\0', "password", CFG_STR
, (void *) &cfg
.password
, 0},
119 {NULL
, '\0', "pkcs9_email", CFG_STR
, (void *) &cfg
.pkcs9_email
, 0},
120 {NULL
, '\0', "country", CFG_STR
, (void *) &cfg
.country
, 0},
121 {NULL
, '\0', "dns_name", CFG_STR
| CFG_MULTI_ARRAY
,
122 (void *) &cfg
.dns_name
, 0},
123 {NULL
, '\0', "ip_address", CFG_STR
| CFG_MULTI_ARRAY
,
124 (void *) &cfg
.ip_addr
, 0},
125 {NULL
, '\0', "email", CFG_STR
| CFG_MULTI_ARRAY
, (void *) &cfg
.email
, 0},
127 {NULL
, '\0', "dn_oid", CFG_STR
+ CFG_MULTI_SEPARATED
,
128 (void *) &cfg
.dn_oid
, 0},
129 {NULL
, '\0', "key_purpose_oids", CFG_STR
+ CFG_MULTI_SEPARATED
,
130 (void *) &cfg
.key_purpose_oids
, 0},
132 {NULL
, '\0', "crl_dist_points", CFG_STR
,
133 (void *) &cfg
.crl_dist_points
, 0},
134 {NULL
, '\0', "pkcs12_key_name", CFG_STR
,
135 (void *) &cfg
.pkcs12_key_name
, 0},
137 {NULL
, '\0', "serial", CFG_INT
, (void *) &cfg
.serial
, 0},
138 {NULL
, '\0', "expiration_days", CFG_INT
,
139 (void *) &cfg
.expiration_days
, 0},
141 {NULL
, '\0', "crl_next_update", CFG_INT
,
142 (void *) &cfg
.crl_next_update
, 0},
144 {NULL
, '\0', "crl_number", CFG_INT
,
145 (void *) &cfg
.crl_number
, 0},
147 {NULL
, '\0', "ca", CFG_BOOL
, (void *) &cfg
.ca
, 0},
148 {NULL
, '\0', "honor_crq_extensions", CFG_BOOL
,
149 (void *) &cfg
.crq_extensions
, 0},
150 {NULL
, '\0', "path_len", CFG_INT
, (void *) &cfg
.path_len
, 0},
151 {NULL
, '\0', "tls_www_client", CFG_BOOL
,
152 (void *) &cfg
.tls_www_client
, 0},
153 {NULL
, '\0', "tls_www_server", CFG_BOOL
,
154 (void *) &cfg
.tls_www_server
, 0},
155 {NULL
, '\0', "signing_key", CFG_BOOL
, (void *) &cfg
.signing_key
,
157 {NULL
, '\0', "encryption_key", CFG_BOOL
,
158 (void *) &cfg
.encryption_key
, 0},
159 {NULL
, '\0', "cert_signing_key", CFG_BOOL
,
160 (void *) &cfg
.cert_sign_key
, 0},
161 {NULL
, '\0', "crl_signing_key", CFG_BOOL
,
162 (void *) &cfg
.crl_sign_key
, 0},
163 {NULL
, '\0', "code_signing_key", CFG_BOOL
,
164 (void *) &cfg
.code_sign_key
, 0},
165 {NULL
, '\0', "ocsp_signing_key", CFG_BOOL
,
166 (void *) &cfg
.ocsp_sign_key
, 0},
167 {NULL
, '\0', "time_stamping_key", CFG_BOOL
,
168 (void *) &cfg
.time_stamping_key
, 0},
169 {NULL
, '\0', "proxy_policy_language", CFG_STR
,
170 (void *) &cfg
.proxy_policy_language
, 0},
174 /* Creating context */
175 con
= cfg_get_context (options
);
178 puts ("Not enough memory");
182 cfg_set_cfgfile_context (con
, 0, -1, (char *) template);
184 /* Parsing command line */
185 ret
= cfg_parse (con
);
189 printf ("error parsing command line: %s: ", template);
190 cfg_fprint_error (con
, stdout
);
192 exit (ret
< 0 ? -ret
: ret
);
199 read_crt_set (gnutls_x509_crt_t crt
, const char *input_str
, const char *oid
)
204 fputs (input_str
, stderr
);
205 if (fgets (input
, sizeof (input
), stdin
) == NULL
)
208 if (strlen (input
) == 1) /* only newline */
212 gnutls_x509_crt_set_dn_by_oid (crt
, oid
, 0, input
, strlen (input
) - 1);
215 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
221 read_crq_set (gnutls_x509_crq_t crq
, const char *input_str
, const char *oid
)
226 fputs (input_str
, stderr
);
227 if (fgets (input
, sizeof (input
), stdin
) == NULL
)
230 if (strlen (input
) == 1) /* only newline */
234 gnutls_x509_crq_set_dn_by_oid (crq
, oid
, 0, input
, strlen (input
) - 1);
237 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
242 /* The input_str should contain %d or %u to print the default.
245 read_int_with_default (const char *input_str
, int def
)
251 printf (input_str
, def
);
254 l
= strtol (in
, &endptr
, 0);
258 fprintf (stderr
, "Trailing garbage ignored: `%s'\n", endptr
);
263 if (l
<= INT_MIN
|| l
>= INT_MAX
)
265 fprintf (stderr
, "Integer out of range: `%s'\n", in
);
279 read_int (const char *input_str
)
281 return read_int_with_default (input_str
, 0);
285 read_str (const char *input_str
)
287 static char input
[128];
290 fputs (input_str
, stderr
);
291 if (fgets (input
, sizeof (input
), stdin
) == NULL
)
294 len
= strlen (input
);
295 if ((len
> 0) && (input
[len
- 1] == '\n'))
306 read_yesno (const char *input_str
)
310 fputs (input_str
, stderr
);
311 if (fgets (input
, sizeof (input
), stdin
) == NULL
)
314 if (strlen (input
) == 1) /* only newline */
317 if (input
[0] == 'y' || input
[0] == 'Y')
324 /* Wrapper functions for non-interactive mode.
332 return getpass ("Enter password: ");
336 get_confirmed_pass (bool empty_ok
)
342 const char *pass
= NULL
;
348 printf ("Password missmatch, try again.\n");
352 pass
= getpass ("Enter password: ");
353 copy
= strdup (pass
);
354 pass
= getpass ("Confirm password: ");
356 while (strcmp (pass
, copy
) != 0 && !(empty_ok
&& *pass
== '\0'));
365 get_challenge_pass (void)
368 return cfg
.challenge_password
;
370 return getpass ("Enter a challenge password: ");
374 get_crl_dist_point_url (void)
377 return cfg
.crl_dist_points
;
379 return read_str ("Enter the URI of the CRL distribution point: ");
383 get_country_crt_set (gnutls_x509_crt_t crt
)
392 gnutls_x509_crt_set_dn_by_oid (crt
,
393 GNUTLS_OID_X520_COUNTRY_NAME
, 0,
394 cfg
.country
, strlen (cfg
.country
));
397 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
403 read_crt_set (crt
, "Country name (2 chars): ",
404 GNUTLS_OID_X520_COUNTRY_NAME
);
410 get_organization_crt_set (gnutls_x509_crt_t crt
)
416 if (!cfg
.organization
)
420 gnutls_x509_crt_set_dn_by_oid (crt
,
421 GNUTLS_OID_X520_ORGANIZATION_NAME
,
423 strlen (cfg
.organization
));
426 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
432 read_crt_set (crt
, "Organization name: ",
433 GNUTLS_OID_X520_ORGANIZATION_NAME
);
439 get_unit_crt_set (gnutls_x509_crt_t crt
)
449 gnutls_x509_crt_set_dn_by_oid (crt
,
450 GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME
,
451 0, cfg
.unit
, strlen (cfg
.unit
));
454 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
460 read_crt_set (crt
, "Organizational unit name: ",
461 GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME
);
467 get_state_crt_set (gnutls_x509_crt_t crt
)
476 gnutls_x509_crt_set_dn_by_oid (crt
,
477 GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME
,
478 0, cfg
.state
, strlen (cfg
.state
));
481 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
487 read_crt_set (crt
, "State or province name: ",
488 GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME
);
494 get_locality_crt_set (gnutls_x509_crt_t crt
)
503 gnutls_x509_crt_set_dn_by_oid (crt
,
504 GNUTLS_OID_X520_LOCALITY_NAME
, 0,
505 cfg
.locality
, strlen (cfg
.locality
));
508 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
514 read_crt_set (crt
, "Locality name: ", GNUTLS_OID_X520_LOCALITY_NAME
);
520 get_cn_crt_set (gnutls_x509_crt_t crt
)
529 gnutls_x509_crt_set_dn_by_oid (crt
, GNUTLS_OID_X520_COMMON_NAME
,
530 0, cfg
.cn
, strlen (cfg
.cn
));
533 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
539 read_crt_set (crt
, "Common name: ", GNUTLS_OID_X520_COMMON_NAME
);
545 get_uid_crt_set (gnutls_x509_crt_t crt
)
553 ret
= gnutls_x509_crt_set_dn_by_oid (crt
, GNUTLS_OID_LDAP_UID
, 0,
554 cfg
.uid
, strlen (cfg
.uid
));
557 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
563 read_crt_set (crt
, "UID: ", GNUTLS_OID_LDAP_UID
);
569 get_oid_crt_set (gnutls_x509_crt_t crt
)
577 for (i
= 0; cfg
.dn_oid
[i
] != NULL
; i
+= 2)
579 if (cfg
.dn_oid
[i
+ 1] == NULL
)
581 fprintf (stderr
, "dn_oid: %s does not have an argument.\n",
585 ret
= gnutls_x509_crt_set_dn_by_oid (crt
, cfg
.dn_oid
[i
], 0,
587 strlen (cfg
.dn_oid
[i
+ 1]));
591 fprintf (stderr
, "set_dn_oid: %s\n", gnutls_strerror (ret
));
599 get_key_purpose_set (gnutls_x509_crt_t crt
)
605 if (!cfg
.key_purpose_oids
)
607 for (i
= 0; cfg
.key_purpose_oids
[i
] != NULL
; i
++)
610 gnutls_x509_crt_set_key_purpose_oid (crt
, cfg
.key_purpose_oids
[i
],
615 fprintf (stderr
, "set_key_purpose_oid (%s): %s\n",
616 cfg
.key_purpose_oids
[i
], gnutls_strerror (ret
));
626 get_pkcs9_email_crt_set (gnutls_x509_crt_t crt
)
632 if (!cfg
.pkcs9_email
)
634 ret
= gnutls_x509_crt_set_dn_by_oid (crt
, GNUTLS_OID_PKCS9_EMAIL
, 0,
636 strlen (cfg
.pkcs9_email
));
639 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
645 read_crt_set (crt
, "E-mail: ", GNUTLS_OID_PKCS9_EMAIL
);
653 int default_serial
= time (NULL
);
658 return default_serial
;
663 return read_int_with_default
664 ("Enter the certificate's serial number in decimal (default: %u): ",
676 if (cfg
.expiration_days
<= 0)
679 return cfg
.expiration_days
;
685 days
= read_int ("The certificate will expire in (days): ");
702 read_yesno ("Does the certificate belong to an authority? (y/N): ");
707 get_crq_extensions_status (void)
711 return cfg
.crq_extensions
;
717 ("Do you want to honour the extensions from the request? (y/N): ");
722 get_crl_number (void)
726 return cfg
.crl_number
;
730 return read_int_with_default ("CRL Number: ", 1);
743 return read_int_with_default
744 ("Path length constraint (decimal, %d for no constraint): ", -1);
749 get_pkcs12_key_name (void)
755 if (!cfg
.pkcs12_key_name
)
757 return cfg
.pkcs12_key_name
;
763 name
= read_str ("Enter a name for the key: ");
765 while (name
== NULL
);
771 get_tls_client_status (void)
775 return cfg
.tls_www_client
;
779 return read_yesno ("Is this a TLS web client certificate? (y/N): ");
784 get_tls_server_status (void)
788 return cfg
.tls_www_server
;
793 read_yesno ("Is this also a TLS web server certificate? (y/N): ");
797 #include <sys/types.h>
798 #include <sys/socket.h>
799 #include <arpa/inet.h>
801 /* convert a printable IP to binary */
803 string_to_ip (unsigned char *ip
, const char *str
)
805 int len
= strlen (str
);
809 if (strchr (str
, ':') != NULL
|| len
> 16)
811 ret
= inet_pton (AF_INET6
, str
, ip
);
814 fprintf (stderr
, "Error in IPv6 address %s\n", str
);
824 ret
= inet_pton (AF_INET
, str
, ip
);
827 fprintf (stderr
, "Error in IPv4 address %s\n", str
);
837 get_ip_addr_set (int type
, void *crt
)
840 unsigned char ip
[16];
848 for (i
= 0; cfg
.ip_addr
[i
] != NULL
; i
++)
850 len
= string_to_ip (ip
, cfg
.ip_addr
[i
]);
853 fprintf (stderr
, "Error parsing address: %s\n", cfg
.ip_addr
[i
]);
857 if (type
== TYPE_CRT
)
859 gnutls_x509_crt_set_subject_alt_name (crt
, GNUTLS_SAN_IPADDRESS
,
864 gnutls_x509_crq_set_subject_alt_name (crt
, GNUTLS_SAN_IPADDRESS
,
877 read_str ("Enter the IP address of the subject of the certificate: ");
881 len
= string_to_ip (ip
, p
);
884 fprintf (stderr
, "Error parsing address: %s\n", p
);
888 if (type
== TYPE_CRT
)
889 ret
= gnutls_x509_crt_set_subject_alt_name (crt
, GNUTLS_SAN_IPADDRESS
,
893 ret
= gnutls_x509_crq_set_subject_alt_name (crt
, GNUTLS_SAN_IPADDRESS
,
900 fprintf (stderr
, "set_subject_alt_name: %s\n", gnutls_strerror (ret
));
907 get_email_set (int type
, void *crt
)
916 for (i
= 0; cfg
.email
[i
] != NULL
; i
++)
918 if (type
== TYPE_CRT
)
920 gnutls_x509_crt_set_subject_alt_name (crt
,
921 GNUTLS_SAN_RFC822NAME
,
923 strlen (cfg
.email
[i
]),
927 gnutls_x509_crq_set_subject_alt_name (crt
,
928 GNUTLS_SAN_RFC822NAME
,
930 strlen (cfg
.email
[i
]),
941 p
= read_str ("Enter the e-mail of the subject of the certificate: ");
945 if (type
== TYPE_CRT
)
947 gnutls_x509_crt_set_subject_alt_name (crt
, GNUTLS_SAN_RFC822NAME
, p
,
952 gnutls_x509_crq_set_subject_alt_name (crt
, GNUTLS_SAN_RFC822NAME
, p
,
959 fprintf (stderr
, "set_subject_alt_name: %s\n", gnutls_strerror (ret
));
965 get_dns_name_set (int type
, void *crt
)
974 for (i
= 0; cfg
.dns_name
[i
] != NULL
; i
++)
976 if (type
== TYPE_CRT
)
978 gnutls_x509_crt_set_subject_alt_name (crt
, GNUTLS_SAN_DNSNAME
,
980 strlen (cfg
.dns_name
[i
]),
984 gnutls_x509_crq_set_subject_alt_name (crt
, GNUTLS_SAN_DNSNAME
,
986 strlen (cfg
.dns_name
[i
]),
1000 read_str ("Enter a dnsName of the subject of the certificate: ");
1004 if (type
== TYPE_CRT
)
1005 ret
= gnutls_x509_crt_set_subject_alt_name
1006 (crt
, GNUTLS_SAN_DNSNAME
, p
, strlen (p
), GNUTLS_FSAN_APPEND
);
1008 ret
= gnutls_x509_crq_set_subject_alt_name
1009 (crt
, GNUTLS_SAN_DNSNAME
, p
, strlen (p
), GNUTLS_FSAN_APPEND
);
1016 fprintf (stderr
, "set_subject_alt_name: %s\n", gnutls_strerror (ret
));
1023 get_sign_status (int server
)
1029 return cfg
.signing_key
;
1035 "Will the certificate be used for signing (DHE and RSA-EXPORT ciphersuites)? (y/N): ";
1038 "Will the certificate be used for signing (required for TLS)? (y/N): ";
1039 return read_yesno (msg
);
1044 get_encrypt_status (int server
)
1050 return cfg
.encryption_key
;
1056 "Will the certificate be used for encryption (RSA ciphersuites)? (y/N): ";
1059 "Will the certificate be used for encryption (not required for TLS)? (y/N): ";
1060 return read_yesno (msg
);
1065 get_cert_sign_status (void)
1069 return cfg
.cert_sign_key
;
1075 ("Will the certificate be used to sign other certificates? (y/N): ");
1080 get_crl_sign_status (void)
1084 return cfg
.crl_sign_key
;
1089 read_yesno ("Will the certificate be used to sign CRLs? (y/N): ");
1094 get_code_sign_status (void)
1098 return cfg
.code_sign_key
;
1103 read_yesno ("Will the certificate be used to sign code? (y/N): ");
1108 get_ocsp_sign_status (void)
1112 return cfg
.ocsp_sign_key
;
1118 ("Will the certificate be used to sign OCSP requests? (y/N): ");
1123 get_time_stamp_status (void)
1127 return cfg
.time_stamping_key
;
1133 ("Will the certificate be used for time stamping? (y/N): ");
1138 get_crl_next_update (void)
1144 if (cfg
.crl_next_update
<= 0)
1147 return cfg
.crl_next_update
;
1153 days
= read_int ("The next CRL will be issued in (days): ");
1161 get_proxy_policy (char **policy
, size_t * policylen
)
1167 ret
= cfg
.proxy_policy_language
;
1169 ret
= "1.3.6.1.5.5.7.21.1";
1175 ret
= read_str ("Enter the OID of the proxy policy language: ");
1177 while (ret
== NULL
);
1183 if (strcmp (ret
, "1.3.6.1.5.5.7.21.1") != 0 &&
1184 strcmp (ret
, "1.3.6.1.5.5.7.21.2") != 0)
1186 fprintf (stderr
, "Reading non-standard proxy policy not supported.\n");
1195 get_country_crq_set (gnutls_x509_crq_t crq
)
1204 gnutls_x509_crq_set_dn_by_oid (crq
,
1205 GNUTLS_OID_X520_COUNTRY_NAME
, 0,
1206 cfg
.country
, strlen (cfg
.country
));
1209 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
1215 read_crq_set (crq
, "Country name (2 chars): ",
1216 GNUTLS_OID_X520_COUNTRY_NAME
);
1222 get_organization_crq_set (gnutls_x509_crq_t crq
)
1228 if (!cfg
.organization
)
1232 gnutls_x509_crq_set_dn_by_oid (crq
,
1233 GNUTLS_OID_X520_ORGANIZATION_NAME
,
1234 0, cfg
.organization
,
1235 strlen (cfg
.organization
));
1238 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
1244 read_crq_set (crq
, "Organization name: ",
1245 GNUTLS_OID_X520_ORGANIZATION_NAME
);
1251 get_unit_crq_set (gnutls_x509_crq_t crq
)
1261 gnutls_x509_crq_set_dn_by_oid (crq
,
1262 GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME
,
1263 0, cfg
.unit
, strlen (cfg
.unit
));
1266 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
1272 read_crq_set (crq
, "Organizational unit name: ",
1273 GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME
);
1279 get_state_crq_set (gnutls_x509_crq_t crq
)
1288 gnutls_x509_crq_set_dn_by_oid (crq
,
1289 GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME
,
1290 0, cfg
.state
, strlen (cfg
.state
));
1293 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
1299 read_crq_set (crq
, "State or province name: ",
1300 GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME
);
1306 get_locality_crq_set (gnutls_x509_crq_t crq
)
1315 gnutls_x509_crq_set_dn_by_oid (crq
,
1316 GNUTLS_OID_X520_LOCALITY_NAME
, 0,
1317 cfg
.locality
, strlen (cfg
.locality
));
1320 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
1326 read_crq_set (crq
, "Locality name: ", GNUTLS_OID_X520_LOCALITY_NAME
);
1332 get_cn_crq_set (gnutls_x509_crq_t crq
)
1341 gnutls_x509_crq_set_dn_by_oid (crq
, GNUTLS_OID_X520_COMMON_NAME
,
1342 0, cfg
.cn
, strlen (cfg
.cn
));
1345 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
1351 read_crq_set (crq
, "Common name: ", GNUTLS_OID_X520_COMMON_NAME
);
1357 get_uid_crq_set (gnutls_x509_crq_t crq
)
1365 ret
= gnutls_x509_crq_set_dn_by_oid (crq
, GNUTLS_OID_LDAP_UID
, 0,
1366 cfg
.uid
, strlen (cfg
.uid
));
1369 fprintf (stderr
, "set_dn: %s\n", gnutls_strerror (ret
));
1375 read_crq_set (crq
, "UID: ", GNUTLS_OID_LDAP_UID
);
1381 get_oid_crq_set (gnutls_x509_crq_t crq
)
1389 for (i
= 0; cfg
.dn_oid
[i
] != NULL
; i
+= 2)
1391 if (cfg
.dn_oid
[i
+ 1] == NULL
)
1393 fprintf (stderr
, "dn_oid: %s does not have an argument.\n",
1397 ret
= gnutls_x509_crq_set_dn_by_oid (crq
, cfg
.dn_oid
[i
], 0,
1399 strlen (cfg
.dn_oid
[i
+ 1]));
1403 fprintf (stderr
, "set_dn_oid: %s\n", gnutls_strerror (ret
));