
Keep something under your hat
Confidentiality
Use when implying the information is confidential and shouldn't be shared. 
Trustworthiness
It suggests trust in the person you're telling, showing confidence that they won't reveal the secret. 
Idiomatic Flavor
It adds a playful or idiomatic flavor to conversations, compared to simply saying 'don't tell anyone'. 