You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: token_jwt_key.go
    path of file: ./repos/casdoor/object
    
    the code of the file until where you have to start completion: // Copyright 2021 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file exc
    
func generateEsKeys(shaSize int, expireInYears int, commonName string, organization string) (string, string, error) {
	var curve elliptic.Curve
	switch shaSize {
	case 256:
		curve = elliptic.P256()
	case 384:
		curve = elliptic.P384()
	case 512:
		curve = elliptic.P521() // ES512(P521,SHA512)
	default:
		return "", "", fmt.Errorf("generateEsKeys() error, unsupported SHA size: %d", shaSize)
	}

	// Generate ECDSA key pair.
	privateKey, err := ecdsa.GenerateKey(curve, rand.Reader)
	if err != nil {
		return "", "", err
	}

	// Encode private key to PEM format.
	privateKeyBytes, err := x509.MarshalECPrivateKey(privateKey)
	if err != nil {
		return "", "", err
	}
	privateKeyPem := pem.EncodeToMemory(&pem.Block{
		Type:  "EC PRIVATE KEY",
		Bytes: privateKeyBytes,
	})

	// Generate certificate template.
	template := x509.Certificate{
		NotBefore:    time.Now(),
		NotAfter:     time.Now().AddDate(expireInYears, 0, 0),
		SerialNumber: big.NewInt(time.Now().Unix()),
		Subject: pkix.Name{
			CommonName:   commonName,
			Organization: []string{organization},
		},
		BasicConstraintsValid: true,
	}

	// Generate certificate.
	certBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &privateKey.PublicKey, privateKey)
	if err != nil {
		return "", "", err
	}

	// Encode certificate to PEM format.
	certPem := pem.EncodeToMemory(&pem.Block{
		Type:  "CERTIFICATE",
		Bytes: certBytes,
	})

	return string(certPem), string(privateKeyPem), nil
}