Roxen.git / server / config_actions / make_csr.pike

version» Context lines:

Roxen.git/server/config_actions/make_csr.pike:1:   /* -  * $Id: make_csr.pike,v 1.7 1998/04/21 18:14:06 nisse Exp $ +  * $Id: make_csr.pike,v 1.8 1998/04/22 14:32:19 grubba Exp $    */      inherit "wizard";      import Standards.PKCS;   import Standards.ASN1.Encode;      #if 0   #define WERROR werror   #else
Roxen.git/server/config_actions/make_csr.pike:170:       return "<font color=red>Could not open key file: "    + strerror(file->errno()) + "\n</font>";    }    privs = 0;    string s = file->read(0x10000);    if (!s)    return "<font color=red>Could not read private key: "    + strerror(file->errno()) + "\n</font>";    + #if constant(Tools)    object msg = Tools.PEM.pem_msg()->init(s);    object part = msg->parts["RSA PRIVATE KEY"];       if (!part)    return "<font color=red>Key file not formatted properly.\n</font>";       object rsa = RSA.parse_private_key(part->decoded_body()); -  + #else /* !constant(Tools)*/ +  /* Backward compatibility */ +  mapping m = SSL.pem.parse_pem(s); +  if (!m || !m["RSA PRIVATE KEY"]) +  return "<font color=red>Key file not formatted properly.\n</font>"; +  +  object rsa = RSA.parse_private_key(m["RSA PRIVATE KEY"]); + #endif /* constant(Tools) */    if (!rsa)    return "<font color=red>Invalid key.\n</font>";       mapping attrs = ([]);    string attr;       /* Remove initial and trailing whitespace, and ignore    * empty attributes. */    foreach( ({ "countryName", "stateOrProvinceName", "localityName",    "organizationName", "organizationUnitName", "commonName",
Roxen.git/server/config_actions/make_csr.pike:230:    /* Not all CA:s support extendedCertificateAttributes */    if (sizeof(cert_attrs))    csr_attrs->extendedCertificateAttributes =    ({ Certificate.Attributes(Identifiers.attribute_ids,    cert_attrs) });       object csr = CSR.build_csr(rsa,    Certificate.build_distinguished_name(@name),    csr_attrs);    + #if constant(Tools)    return "<textarea cols=80 rows=12>"    + Tools.PEM.simple_build_pem("CERTIFICATE REQUEST", csr->der())    +"</textarea>"; -  + #else /* !constant(Tools) */ +  /* Backward compatibility */ +  return "<textarea cols=80 rows=12>" +  + SSL.pem.build_pem("CERTIFICATE REQUEST", csr->der()) +  +"</textarea>"; + #endif /* constant(Tools) */   }      mixed wizard_done(object id, object mc)   {    return 0;   }      mixed handle(object id) { return wizard_for(id,0); }      #endif /* constant(_Crypto) && constant(Crypto.rsa) */