Finished renewCertificate and fixed types of the public keys throughout code