Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:2464:    }    return ids;    }       protected array(string) render_element(int keypair_id)    {    array(Crypto.Sign.State|array(string)) keypair =    CertDB.get_keypair(keypair_id);    if (!keypair) {    return ({ "<td colspan='2'>" + -  LOC_C(0, "Lost certificate") + +  LOC_C(1129, "Lost certificate") +    "</td>" });    }    [Crypto.Sign.State private_key, array(string) certs] = keypair;       Standards.X509.TBSCertificate tbs =    Standards.X509.decode_certificate(certs[0]);       array(string) res = ({});       if (!tbs) {    res += ({ "<td colspan='2'><b>" + -  LOC_C(0, "Invalid certificate") + +  LOC_C(1130, "Invalid certificate") +    ".</b>" });    } else {    mapping(Standards.ASN1.Types.Identifier:string) dn =    parse_dn(tbs->subject);       string tmp;    if ((tmp = dn[Standards.PKCS.Identifiers.at_ids.commonName])) {    res += ({    sprintf("<td style='white-space:nowrap'>%s</td>"    "<td><b><tt>%s</tt></b>", -  LOC_C(0, "Common Name"), +  LOC_C(1131, "Common Name"),    Roxen.html_encode_string(tmp)),    });    } else {    res += ({ "<td colspan='2'>" });    }    -  res[-1] += sprintf(" (%s, " + LOC_C(0, "%d bits") + ")</td>", +  res[-1] += sprintf(" (%s, " + LOC_C(1132, "%d bits") + ")</td>",    Roxen.html_encode_string(private_key->name()),    private_key->key_size());       if (tmp = dn[Standards.PKCS.Identifiers.at_ids.organizationName]) {    if (dn[Standards.PKCS.Identifiers.at_ids.organizationUnitName]) {    tmp += "/" +    dn[Standards.PKCS.Identifiers.at_ids.organizationUnitName];    }    res += ({    sprintf("<td style='white-space:nowrap'>%s</td><td>%s</td>", -  LOC_C(0, "Issued To"), +  LOC_C(1133, "Issued To"),    Roxen.html_encode_string(tmp)),    });    } else if (tmp = dn[Standards.PKCS.Identifiers.at_ids.organizationUnitName]) {    res += ({    sprintf("<td style='white-space:nowrap'>%s</td><td>%s</td>", -  LOC_C(0, "Issued To"), +  LOC_C(1133, "Issued To"),    Roxen.html_encode_string(tmp)),    });    }       if (tbs->issuer->get_der() == tbs->subject->get_der()) {    res += ({    sprintf("<td style='white-space:nowrap'>" + -  LOC_C(0, "Issued By") + +  LOC_C(1134, "Issued By") +    "</td><td>%s</td>", -  LOC_C(0, "Self-signed")) +  LOC_C(1135, "Self-signed"))    });    } else {    dn = parse_dn(tbs->issuer);    tmp = dn[Standards.PKCS.Identifiers.at_ids.organizationName];    if (dn[Standards.PKCS.Identifiers.at_ids.organizationUnitName]) {    tmp = (tmp?(tmp + "/"):"") +    dn[Standards.PKCS.Identifiers.at_ids.organizationUnitName];    }    string tmp2 = dn[Standards.PKCS.Identifiers.at_ids.commonName];    if (tmp2) {    if (tmp) {    tmp = tmp2 + " (" + tmp + ")";    } else {    tmp = tmp2;    }    }    if (tmp) {    res += ({    sprintf("<td style='white-space:nowrap;vertical-align:top'>" + -  LOC_C(0, "Issued By") + +  LOC_C(1134, "Issued By") +    "</td><td>%s</td>",    Roxen.html_encode_string(tmp)),    });    }    }       tmp = Roxen.html_encode_string(Calendar.Second(tbs->not_after)->    format_time());    if (tbs->not_after < time(1)) {    // Already expired.    res += ({    sprintf("<td>%s</td>"    "<td><font color='&usr.warncolor;'>%s</font>\n"    "<img src='&usr.err-3;' /></td>", -  LOC_C(0, "Expired"), +  LOC_C(1136, "Expired"),    tmp),    });    } else if (tbs->not_after < time(1) + (3600 * 24 * 30)) {    // Expires within 30 days.    res += ({    sprintf("<td>%s</td>"    "<td><font color='&usr.warncolor;'>%s</font>\n"    "<img src='&usr.err-2;' /></td>", -  LOC_C(0, "Expires"), +  LOC_C(1137, "Expires"),    tmp),    });    } else {    res += ({ -  sprintf("<td>%s</td><td>%s</td>", LOC_C(0, "Expires"), tmp), +  sprintf("<td>%s</td><td>%s</td>", LOC_C(1137, "Expires"), tmp),    });    }       mapping keypair_metadata = CertDB.get_keypair_metadata(keypair_id);       array(string) paths =    keypair_metadata->certs->pem_path +    ({ keypair_metadata->key->pem_path });    paths = Array.uniq(paths);    paths = replace(paths, 0, "__LOST__");    paths = map(paths, lfile_path);    res += ({    sprintf("<td style='vertical-align:top'>%s</td><td>%s</td>", -  LOC_C(0, "Path(s)"), +  LOC_C(1138, "Path(s)"),    map(paths, lambda(string p) {    if (p)    return "<tt>" + Roxen.html_encode_string(p) + "</tt>";    else    return    "<font color='&usr.warncolor;'>" + -  LOC_C(0, "Lost file") + +  LOC_C(1139, "Lost file") +    "</font>";    }) * "<br/>")    });    }       return res;    }       string render_form(RequestID id, void|mapping additional_args) {    array(string) current = map(query(), _name);