Yes you can lie while under hypnosis and you may even tell some secrets when you're hypnotized.
I've heard of a few people letting out some really secret secrets that they never wanted to let out about themselves while they were under hypnosis.
They were on camera being hypnotized and on a live stream on Youtube and they basically told millions of people around the world about their secret but I guess that's not too big of a deal because the person is likely never to actually meet those people in real life.
There have been people that have also lied under hypnosis so it's possible to lie while being hypnotized.
But you must be a willing subject to be hypnotized so it's not like someone can just come by and hypnotize you without you knowing and get you to spill the beans on your secrets or lie about anything.