What did a painting of a key mean during the medieval era?
That depends on where you saw it. Sometimes it is just a key. In religious paintings, which were probably the most common during the medieval era, a key would usually represent the keys to Heaven. Somebody holding them would be someone who had the authority to let someone into Heaven, or at least to keep the non-righteous from entering it. (i.e. locking them out) If the Devil was holding a key, it would represent the hold he had over the souls in Hell or those who were going to go there. If Jesus, St. Peter, or some other ‘righteous’ person were holding the keys, it would represent that they had already been wrestled away from the Devil.