This is a difficult one. In general, "can" must be used when expressing capability, for example in the sentence "Can you read?". "May" is always used when we are not sure about something, for example "I may go to the shop later".
To the best of my knowledge you can use either "can" or "may" in all other use cases, your sentences being one example. However, using "may" often sounds more polite.
Perhaps someone else can jump in with other use cases that I have not thought about?