code: func (csp *CSP) KeyGen(opts bccsp.KeyGenOpts) (k bccsp.Key, err error) {
  	// Validate arguments
  	if opts == nil {
  		return nil, errors.New("Invalid Opts parameter. It must not be nil.")
  	}
  
  	keyGenerator, found := csp.KeyGenerators[reflect.TypeOf(opts)]
  	if !found {
  		return nil, errors.Errorf("Unsupported 'KeyGenOpts' provided [%v]", opts)
  	}
  
  	k, err = keyGenerator.KeyGen(opts)
  	if err != nil {
  		return nil, errors.Wrapf(err, "Failed generating key with opts [%v]", opts)
  	}
  
  	// If the key is not Ephemeral, store it.
  	if !opts.Ephemeral() {
  		// Store the key
  		err = csp.ks.StoreKey(k)
  		if err != nil {
  			return nil, errors.Wrapf(err, "Failed storing key [%s]", opts.Algorithm())
  		}
  	}
  
  	return k, nil
  }
docs: // KeyGen generates a key using opts.