cred_encoding_type_t form = CERT_ASN1_DER;
chunk_t scep_response = chunk_empty;
char *arg, *url = NULL, *caout = NULL, *raout = NULL;
- bool force = FALSE, success;
+ bool force = FALSE, success, next_ca = FALSE;
u_int http_code = 0;
while (TRUE)
case 'r': /* --raout */
raout = arg;
continue;
+ case 'n': /* --nextca */
+ next_ca = TRUE;
+ continue;
case 'f': /* --form */
if (!get_form(arg, &form, CRED_CERTIFICATE))
{
return command_usage("--url is required");
}
- if (!scep_http_request(url, SCEP_GET_CA_CERT, FALSE, chunk_empty,
- &scep_response, &http_code))
+ if (!scep_http_request(url, next_ca ? SCEP_GET_NEXT_CA_CERT : SCEP_GET_CA_CERT,
+ FALSE, chunk_empty, &scep_response, &http_code))
{
DBG1(DBG_APP, "did not receive a valid SCEP response: HTTP %u", http_code);
return 1;
command_register((command_t) {
scepca, 'C', "scepca",
"get CA [and RA] certificate[s] from a SCEP server",
- {"--url url [--caout file] [--raout file] [--outform der|pem] [--force]"},
+ {"--url url [--caout file] [--raout file] [--nextca] [--outform der|pem] [--force]"},
{
{"help", 'h', 0, "show usage information"},
{"url", 'u', 1, "URL of the SCEP server"},
{"caout", 'c', 1, "CA certificate [template]"},
{"raout", 'r', 1, "RA certificate [template]"},
+ {"nextca", 'n', 0, "get next CA if available"},
{"outform", 'f', 1, "encoding of stored certificates, default: der"},
{"force", 'F', 0, "force overwrite of existing files"},
}