code: func getStateAndDecrypt(stub shim.ChaincodeStubInterface, ent entities.Encrypter, key string) ([]byte, error) {
  	// at first we retrieve the ciphertext from the ledger
  	ciphertext, err := stub.GetState(key)
  	if err != nil {
  		return nil, err
  	}
  
  	// GetState will return a nil slice if the key does not exist.
  	// Note that the chaincode logic may want to distinguish between
  	// nil slice (key doesn't exist in state db) and empty slice
  	// (key found in state db but value is empty). We do not
  	// distinguish the case here
  	if len(ciphertext) == 0 {
  		return nil, errors.New("no ciphertext to decrypt")
  	}
  
  	return ent.Decrypt(ciphertext)
  }
docs: // the functions below show some best practices on how
  // to use entities to perform cryptographic operations
  // over the ledger state
  // getStateAndDecrypt retrieves the value associated to key,
  // decrypts it with the supplied entity and returns the result
  // of the decryption