code: func ecGenerate(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, label, curveStr string) (*ecdsa.PublicKey, error) {
  	curve, present := stringToCurve[curveStr]
  	if !present {
  		return nil, fmt.Errorf("curve %q not supported", curveStr)
  	}
  	keyID := make([]byte, 4)
  	_, err := rand.Read(keyID)
  	if err != nil {
  		return nil, err
  	}
  	log.Printf("Generating ECDSA key with curve %s and ID %x\n", curveStr, keyID)
  	args := ecArgs(label, curve, keyID)
  	pub, priv, err := ctx.GenerateKeyPair(session, args.mechanism, args.publicAttrs, args.privateAttrs)
  	if err != nil {
  		return nil, err
  	}
  	log.Println("Key generated")
  	log.Println("Extracting public key")
  	pk, err := ecPub(ctx, session, pub, curve)
  	if err != nil {
  		return nil, err
  	}
  	log.Println("Extracted public key")
  	log.Println("Verifying public key")
  	err = ecVerify(ctx, session, priv, pk)
  	if err != nil {
  		return nil, err
  	}
  	log.Println("Key verified")
  	return pk, nil
  }
docs: // ecGenerate is used to generate and verify a ECDSA key pair of the type
  // specified by curveStr and with the provided label. It returns the public
  // part of the generated key pair as a ecdsa.PublicKey.