Skip to content

How to get challenge password out of request

Florian Rüchel edited this page Mar 12, 2015 · 1 revision
int passwd_index = X509_REQ_get_attr_by_NID(req, NID_pkcs9_challengePassword, -1);
if(passwd_index == -1) {
    scep_log(handle, ERROR, "Need challenge password field on CSR.\n");
    return SCEPE_INVALID_CONTENT;
}
X509_ATTRIBUTE *attr = X509_REQ_get_attr(req, passwd_index);
ASN1_TYPE *ext = sk_ASN1_TYPE_value(attr->value.set, 0);
scep_log(handle, ERROR, "Challenge Password: %s\n", ASN1_STRING_data(ext->value.printablestring));
Clone this wiki locally