code: func GeneratePrivateKey(keystorePath string) (bccsp.Key,
  	crypto.Signer, error) {
  
  	var err error
  	var priv bccsp.Key
  	var s crypto.Signer
  
  	opts := &factory.FactoryOpts{
  		ProviderName: "SW",
  		SwOpts: &factory.SwOpts{
  			HashFamily: "SHA2",
  			SecLevel:   256,
  
  			FileKeystore: &factory.FileKeystoreOpts{
  				KeyStorePath: keystorePath,
  			},
  		},
  	}
  	csp, err := factory.GetBCCSPFromOpts(opts)
  	if err == nil {
  		// generate a key
  		priv, err = csp.KeyGen(&bccsp.ECDSAP256KeyGenOpts{Temporary: false})
  		if err == nil {
  			// create a crypto.Signer
  			s, err = signer.New(csp, priv)
  		}
  	}
  	return priv, s, err
  }
docs: // GeneratePrivateKey creates a private key and stores it in keystorePath