code: func RenewExistingCert(certsDir, baseName string, impl Interface) error {
  	certificatePath, _ := pkiutil.PathsForCertAndKey(certsDir, baseName)
  	certs, err := certutil.CertsFromFile(certificatePath)
  	if err != nil {
  		return errors.Wrapf(err, "failed to load existing certificate %s", baseName)
  	}
  
  	if len(certs) != 1 {
  		return errors.Errorf("wanted exactly one certificate, got %d", len(certs))
  	}
  
  	cfg := certToConfig(certs[0])
  	newCert, newKey, err := impl.Renew(cfg)
  	if err != nil {
  		return errors.Wrapf(err, "failed to renew certificate %s", baseName)
  	}
  
  	if err := pkiutil.WriteCertAndKey(certsDir, baseName, newCert, newKey); err != nil {
  		return errors.Wrapf(err, "failed to write new certificate %s", baseName)
  	}
  	return nil
  }
docs: // RenewExistingCert loads a certificate file, uses the renew interface to renew it,
  // and saves the resulting certificate and key over the old one.