Moved cert generation over to its own function so that it can be reused to generate newer certificates.