//---------------------------------------------------------------------------
const std::string RandomCode::CreateRandomLine(const unsigned int length)
{
  std::string s = "  ";
  for (unsigned int i=0; i!=length; ++i)
  {
    s+=CreateRandomString();
  }
  s+=";";
  return s;
}
示例#2
0
OpenSSLCertificate* OpenSSLCertificate::Generate(
    OpenSSLKeyPair* key_pair, const std::string& common_name) {
  std::string actual_common_name = common_name;
  if (actual_common_name.empty())
    // Use a random string, arbitrarily 8chars long.
    actual_common_name = CreateRandomString(8);
  X509* x509 = MakeCertificate(key_pair->pkey(), actual_common_name.c_str());
  if (!x509) {
    LogSSLErrors("Generating certificate");
    return NULL;
  }
#ifdef _DEBUG
  PrintCert(x509);
#endif
  return new OpenSSLCertificate(x509);
}