code: func (ks *fileBasedKeyStore) StoreKey(k bccsp.Key) (err error) {
  	if ks.readOnly {
  		return errors.New("Read only KeyStore.")
  	}
  
  	if k == nil {
  		return errors.New("Invalid key. It must be different from nil.")
  	}
  	switch k.(type) {
  	case *ecdsaPrivateKey:
  		kk := k.(*ecdsaPrivateKey)
  
  		err = ks.storePrivateKey(hex.EncodeToString(k.SKI()), kk.privKey)
  		if err != nil {
  			return fmt.Errorf("Failed storing ECDSA private key [%s]", err)
  		}
  
  	case *ecdsaPublicKey:
  		kk := k.(*ecdsaPublicKey)
  
  		err = ks.storePublicKey(hex.EncodeToString(k.SKI()), kk.pubKey)
  		if err != nil {
  			return fmt.Errorf("Failed storing ECDSA public key [%s]", err)
  		}
  
  	case *rsaPrivateKey:
  		kk := k.(*rsaPrivateKey)
  
  		err = ks.storePrivateKey(hex.EncodeToString(k.SKI()), kk.privKey)
  		if err != nil {
  			return fmt.Errorf("Failed storing RSA private key [%s]", err)
  		}
  
  	case *rsaPublicKey:
  		kk := k.(*rsaPublicKey)
  
  		err = ks.storePublicKey(hex.EncodeToString(k.SKI()), kk.pubKey)
  		if err != nil {
  			return fmt.Errorf("Failed storing RSA public key [%s]", err)
  		}
  
  	case *aesPrivateKey:
  		kk := k.(*aesPrivateKey)
  
  		err = ks.storeKey(hex.EncodeToString(k.SKI()), kk.privKey)
  		if err != nil {
  			return fmt.Errorf("Failed storing AES key [%s]", err)
  		}
  
  	default:
  		return fmt.Errorf("Key type not reconigned [%s]", k)
  	}
  
  	return
  }
docs: // StoreKey stores the key k in this KeyStore.
  // If this KeyStore is read only then the method will fail.