Implemented one function in bac.c which takes care key handshake