Permalink
Browse files

Make certs valid for 10 years

Previously, a certificate generated with --makepem expired after a year which is
weird and pointless (come on, it's self-signed!).

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information...
1 parent a816be6 commit a0f977d26a337da93a2a9029355f919b38ad8ca6 @psychon psychon committed with Kyle Fuller Jan 13, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 Utils.cpp
View
@@ -34,6 +34,7 @@ void CUtils::GenerateCert(FILE *pOut, const CString& sHost) {
X509 *pCert = NULL;
X509_NAME *pName = NULL;
const int days = 365;
+ const int years = 10;
u_int iSeed = time(NULL);
int serial = (rand_r(&iSeed) % 9999);
@@ -55,7 +56,7 @@ void CUtils::GenerateCert(FILE *pOut, const CString& sHost) {
X509_set_version(pCert, 2);
ASN1_INTEGER_set(X509_get_serialNumber(pCert), serial);
X509_gmtime_adj(X509_get_notBefore(pCert), 0);
- X509_gmtime_adj(X509_get_notAfter(pCert), (long)60*60*24*days);
+ X509_gmtime_adj(X509_get_notAfter(pCert), (long)60*60*24*days*years);
X509_set_pubkey(pCert, pKey);
pName = X509_get_subject_name(pCert);

0 comments on commit a0f977d

Please sign in to comment.