@@ -192,6 +192,8 @@ def _create_certificate_chain():
192
192
3. A new server certificate signed by icert (scert)
193
193
"""
194
194
caext = X509Extension (b'basicConstraints' , False , b'CA:true' )
195
+ not_after_date = (datetime .date .today () + datetime .timedelta (days = 365 ))
196
+ not_after = not_after_date .strftime ("%Y%m%d%H%M%SZ" ).encode ("ascii" )
195
197
196
198
# Step 1
197
199
cakey = PKey ()
@@ -201,7 +203,7 @@ def _create_certificate_chain():
201
203
cacert .set_issuer (cacert .get_subject ())
202
204
cacert .set_pubkey (cakey )
203
205
cacert .set_notBefore (b"20000101000000Z" )
204
- cacert .set_notAfter (b"20200101000000Z" )
206
+ cacert .set_notAfter (not_after )
205
207
cacert .add_extensions ([caext ])
206
208
cacert .set_serial_number (0 )
207
209
cacert .sign (cakey , "sha1" )
@@ -214,7 +216,7 @@ def _create_certificate_chain():
214
216
icert .set_issuer (cacert .get_subject ())
215
217
icert .set_pubkey (ikey )
216
218
icert .set_notBefore (b"20000101000000Z" )
217
- icert .set_notAfter (b"20200101000000Z" )
219
+ icert .set_notAfter (not_after )
218
220
icert .add_extensions ([caext ])
219
221
icert .set_serial_number (0 )
220
222
icert .sign (cakey , "sha1" )
@@ -227,7 +229,7 @@ def _create_certificate_chain():
227
229
scert .set_issuer (icert .get_subject ())
228
230
scert .set_pubkey (skey )
229
231
scert .set_notBefore (b"20000101000000Z" )
230
- scert .set_notAfter (b"20200101000000Z" )
232
+ scert .set_notAfter (not_after )
231
233
scert .add_extensions ([
232
234
X509Extension (b'basicConstraints' , True , b'CA:false' )])
233
235
scert .set_serial_number (0 )
0 commit comments