also how do you get out of your cell do you need to smuggle the masterkey or is it something else ?
Yup, your guess is correct. You need to smuggle an item to open the lock. There are a few possible solutions, the ultimate key that you fuse at the blacksmith is one of them.