sgallagher / sscg

Simple Signed Certificate Generator
GNU General Public License v3.0
77 stars 13 forks source link

Correct certificate lifetime calculation #28

Closed allisonkarlitskaya closed 2 years ago

allisonkarlitskaya commented 2 years ago

sscg allows passing the certificate lifetime, as a number of days, as a commandline argument. It converts this value to seconds using the formula

days 24 3650

which is incorrect. The correct value is 3600.

This effectively adds an extra 20 minutes to the lifetime of the certificate for each day as given on the commandline, and was enough to cause some new integration tests in cockpit to fail.

Interestingly, 3650 is the old default value for the number of days of certificate validity (~10 years) so this probably slipped in as a sort of muscle-memory-assisted typo.

Let's just write 24 * 60 * 60 to make things clear.