|
Lines 118-124
Link Here
|
| 118 |
// added to generate different serial number than previous versions |
118 |
// added to generate different serial number than previous versions |
| 119 |
// needs to be added as an option |
119 |
// needs to be added as an option |
| 120 |
std::string sname(commonname ); |
120 |
std::string sname(commonname ); |
| 121 |
sname += "A"; |
121 |
sname += "B"; |
| 122 |
|
122 |
|
| 123 |
#ifdef DGDEBUG |
123 |
#ifdef DGDEBUG |
| 124 |
std::cout << "Generating serial no for " << commonname << std::endl; |
124 |
std::cout << "Generating serial no for " << commonname << std::endl; |
|
Lines 390-395
Link Here
|
| 390 |
return NULL; |
390 |
return NULL; |
| 391 |
} |
391 |
} |
| 392 |
|
392 |
|
|
|
393 |
{ |
| 394 |
String temp1 = "DNS:"; |
| 395 |
String temp2 = commonname; |
| 396 |
temp1 = temp1 + temp2; |
| 397 |
char *value = (char*) temp1.toCharArray(); |
| 398 |
if( !addExtension(newCert, NID_subject_alt_name, value)) |
| 399 |
log_ssl_errors("Error adding subjectAltName to the request", commonname); |
| 400 |
} |
| 393 |
//sign it using the ca |
401 |
//sign it using the ca |
| 394 |
ERR_clear_error(); |
402 |
ERR_clear_error(); |
| 395 |
if (!X509_sign(newCert, _caPrivKey, EVP_sha256())) { |
403 |
if (!X509_sign(newCert, _caPrivKey, EVP_sha256())) { |
|
Lines 521-524
Link Here
|
| 521 |
if (_caPrivKey) EVP_PKEY_free(_caPrivKey); |
529 |
if (_caPrivKey) EVP_PKEY_free(_caPrivKey); |
| 522 |
if (_certPrivKey) EVP_PKEY_free(_certPrivKey); |
530 |
if (_certPrivKey) EVP_PKEY_free(_certPrivKey); |
| 523 |
} |
531 |
} |
|
|
532 |
|
| 533 |
bool CertificateAuthority::addExtension(X509 *cert, int nid, char *value) |
| 534 |
{ |
| 535 |
X509_EXTENSION *ex = NULL; |
| 536 |
|
| 537 |
ex = X509V3_EXT_conf_nid(NULL,NULL , nid, value); |
| 538 |
|
| 539 |
int result = X509_add_ext(cert, ex, -1); |
| 540 |
|
| 541 |
X509_EXTENSION_free(ex); |
| 542 |
|
| 543 |
return (result > 0) ? true : false; |
| 544 |
} |
| 545 |
|
| 524 |
#endif //__SSLMITM |
546 |
#endif //__SSLMITM |